Commit 3792f387 authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

Assigned proper html files to views.py, edited the books html page, edited urls.py

parent 144d5013
......@@ -2,8 +2,22 @@
{% load static %}
{% block title %}{% endblock %}
{% block title %}My Favorite Books{% endblock %}
{% block content %}
<h1>Gabi's Favorite Books:</h1>
<ul>
{% for objects in object_list %}
<li>
<a href = "{{ object.get_absolute_url }}">
{{ object.title }}
</a>
</li>
{% endfor %}
</ul>
<a href='/bookshelf/home/'>Home</a>
<a href='/bookshelf/authors/'>Authors</a>
{% endblock %}
\ No newline at end of file
from django.urls import path
from . import views
from .views import (
home, BooksListView, BooksDetailView,
AuthorListView, AuthorDetailView
)
urlpatterns = [
path('home/', views.home, name = 'home'),
path('books/', views.BooksListView.as_view(), name = 'books-list'),
path('books/<int:pk>/details', views.BooksDetailView.as_view(), name = 'books-details'),
path('authors/', views.AuthorListView.as_view(), name = 'author-list'),
path('authors/<int:pk>/details', views.AuthorDetailView.as_view(), name = 'author-details'),
path('home/', home, name = 'home'),
path('books/', BooksListView.as_view(), name = 'books-list'),
path('books/<int:pk>/details', BooksDetailView.as_view(), name = 'books-details'),
path('authors/', AuthorListView.as_view(), name = 'author-list'),
path('authors/<int:pk>/details', AuthorDetailView.as_view(), name = 'author-details'),
]
app_name = "bookshelf"
\ No newline at end of file
......@@ -9,12 +9,16 @@ def home(request):
class BooksListView(ListView):
model = Books
template_name = 'bookshelf/books.html'
class BooksDetailView(DetailView):
model = Books
template_name = 'bookshelf/books_details.html'
class AuthorListView(ListView):
model = Author
template_name = 'bookshelf/authors.html'
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
\ No newline at end of file
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