Commit bdbd3cf4 authored by Star Neptune R. Sy's avatar Star Neptune R. Sy

restored the html files.

parent 5f93991c
...@@ -12,6 +12,8 @@ class Author(models.Model): ...@@ -12,6 +12,8 @@ class Author(models.Model):
return "{} {}".format(self.first_name, self.last_name) return "{} {}".format(self.first_name, self.last_name)
class Book(models.Model): class Book(models.Model):
title = models.CharField(max_length=50, blank=True) title = models.CharField(max_length=50, blank=True)
author = models.ForeignKey( author = models.ForeignKey(
......
# bookshelf/urls.py # bookshelf/urls.py
from django.urls import path from django.urls import path
from .views import index from .views import (homeView, BooksView, BooksDetail)
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('home/', homeView, name='home'),
path('books/', BooksView.as_view(), name="books"),
path('books/<int:pk>/details', BooksDetail.as_view(), name="book_details")
] ]
# This might be needed, depending on your Django version # This might be needed, depending on your Django version
......
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Author, Book
# Create your views here. def homeView(request):
return render(request, 'home.html')
class BooksView(ListView):
model = Book
template_name = "bookshelf/books.html"
class BooksDetail(DetailView):
model = Book
template_name = "bookshelf/bookDetais.html"
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