Commit e2aabe31 authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

Fixed typos in books.html, views.py, and urls.py, updated book_details.html to...

Fixed typos in books.html, views.py, and urls.py, updated book_details.html to show the appropriate info
parent b798f5f5
......@@ -12,7 +12,7 @@ class Author(models.Model):
return self.first_name + ' ' + self.last_name
def get_absolute_url(self):
return reverse("author-detail", kwargs = {"pk": self.pk})
return reverse("bookshelf:author-details", kwargs = {"pk": self.pk})
class Books(models.Model):
title = models.CharField(max_length = 100)
......@@ -26,4 +26,4 @@ class Books(models.Model):
return self.title
def get_absolute_url(self):
return reverse("books-detail", kwargs = {"pk": self.pk})
\ No newline at end of file
return reverse("bookshelf:books-details", kwargs = {"pk": self.pk})
\ No newline at end of file
......@@ -2,8 +2,17 @@
{% load static %}
{% block title %}{% endblock %}
{% block title %} {{ object.title }} {% endblock %}
{% block content %}
<h1> {{ object.title }} </h1>
<a href = '{{ object.author.get_absolute_url }}'>{{ object.author }}</a>
<p>{{ object.publisher }}</p>
<p>{{ object.year_published }}</p>
<p>{{ object.ISBN }}</p>
<p>{{ object.blurb }}</p>
<a href = 'bookshelf/home/'>Home</a>
<a href = 'bookshelf/books/'>Books</a>
<a href = 'bookshelf/authors/'>Authors</a>
{% endblock %}
\ No newline at end of file
......@@ -8,16 +8,14 @@
<h1>Gabi's Favorite Books:</h1>
<ul>
{% for objects in object_list %}
{% for object in object_list %}
<li>
<a href = "{{ object.get_absolute_url }}">
{{ object.title }}
</a>
<a href = "{{ object.get_absolute_url }}">{{ object.title }}</a>
</li>
{% endfor %}
</ul>
<a href='/bookshelf/home/'>Home</a>
<a href='/bookshelf/authors/'>Authors</a>
<a href = '/bookshelf/home/'>Home</a>
<a href = '/bookshelf/authors/'>Authors</a>
{% endblock %}
\ No newline at end of file
......@@ -6,7 +6,7 @@ from .views import (
urlpatterns = [
path('home/', home, name = 'home'),
path('books/', BooksListView.as_view(), name = 'books-list'),
path('books/', BooksListView.as_view(), name = 'book-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'),
......
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