Commit bb05f268 authored by Washington99's avatar Washington99

Handling of bookshelf url

Created a simple views file to be edited later which can now be used to open a url path to a bookshelf site. This will be used to display model entries later.
parent b56bd07f
from django.contrib import admin
# Register your models here.
# Register your models here.
\ No newline at end of file
# Generated by Django 4.1.7 on 2023-03-28 05:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('age', models.IntegerField()),
('nationality', models.CharField(max_length=50)),
('bio', models.CharField(max_length=700)),
],
),
migrations.CreateModel(
name='Books',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=50)),
('publisher', models.CharField(max_length=50)),
('year_published', models.IntegerField()),
('ISBN', models.CharField(max_length=13)),
('blurb', models.TextField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bookshelf.author')),
],
),
]
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "bookshelf"
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Test output")
......@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bookshelf'
]
MIDDLEWARE = [
......
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('bookshelf/', include('bookshelf.urls', namespace = 'bookshelf'))
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment