Commit a37a0dd3 authored by Cheska Hung's avatar Cheska Hung

authors page

parent 559ecdc4
Pipeline #3039 canceled with stages
from django.urls import path
from . import views
from .views import HomeView, BooksListView, BooksDetailView
from .views import HomeView, BooksListView, BooksDetailView, AuthorListView
urlpatterns = [
......@@ -9,6 +9,9 @@ urlpatterns = [
path('books/', BooksListView.as_view(), name='books'),
path('books/<int:pk>/details', BooksDetailView.as_view(),
name='books-detail'),
path('authors/', AuthorListView.as_view(), name='author'),
path('books/<int:pk>/details', BooksDetailView.as_view(),
name='books-detail'),
]
......@@ -20,3 +20,7 @@ class BooksListView(ListView):
class BooksDetailView(DetailView):
model = Books
template_name = 'books_details.html'
class AuthorListView(ListView):
model = Author
template_name = 'authors.html'
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>Cheska's Favorite Authors:</h1>
{% for Author in object_list %}
<li>
<a href="{{ Author.get_absolute_url }}">
{{Author.first_name}} {{Author.last_name}}
</a>
</li>
{% endfor %}
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block content %}
{% for Books in object_list %}
<li>
<a href="{{ get_absolute_url }}">
<a href="{{ Books.get_absolute_url }}">
{{Books.title}}
</a>
</li>
......
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