Commit 53587adc authored by Migs Atienza's avatar Migs Atienza

Created authors.html

parent 6781d806
{% extends 'base.html' %}
{% block title %}My Favorite Authors{% endblock %}
{% block heading %}<center>Migs' Favorite Authors</center>{% endblock %}
{% block content %}<center>
<ul>
{% for object in object_list %}
<li>
<a href="{{ object.get_absolute_url }}">
{{ object.first_name }} {{ object.last_name }}
</a>
</li>
{% endfor %}
</ul>
</center>{% endblock %}
{% block links %}
<center><br/><br/><br/><br/><br/>
<a href="home">Home</a>
<a href="books">Books</a></center>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import index, home_view, BooksListView, BooksDetailView from .views import index, home_view, BooksListView, BooksDetailView, AuthorsListView, AuthorsDetailView
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
path('home', home_view, name='home_view'), path('home', home_view, name='home_view'),
path('books', BooksListView.as_view(), name='books_list'), path('books', BooksListView.as_view(), name='books_list'),
path('books/<int:pk>/details', BooksDetailView.as_view(), name='books_details'), path('books/<int:pk>/details', BooksDetailView.as_view(), name='books_details'),
path('authors', AuthorsListView.as_view(), name='authors_list'),
path('authors/<int:pk>/details', AuthorsDetailView.as_view(), name='authors_details'),
] ]
app_name = "<bookshelf>" app_name = "<bookshelf>"
......
...@@ -22,4 +22,14 @@ class BooksListView(ListView): ...@@ -22,4 +22,14 @@ class BooksListView(ListView):
class BooksDetailView(DetailView): class BooksDetailView(DetailView):
model = Book model = Book
template_name = "bookshelf/books_details.html" template_name = "bookshelf/books_details.html"
class AuthorsListView(ListView):
model = Author
template_name = "bookshelf/authors.html"
class AuthorsDetailView(DetailView):
model = Author
template_name = "bookshelf/authors_details.html"
# Create your views here. # Create your views here.
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