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

book and book_detais are working

parent 8222a430
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<h1>{% block additional %}{% endblock %}</h1>
<div>{% block content %}{% endblock %}</div>
</body>
{% extends 'base.html' %}
{% block title %} {{ object.title }} {% endblock %}
{% block additional %} {{ object.title }} {% endblock %}
{% block content %}
<ul>
<li> {{ object.author }} </li>
<li> {{ object.publisher}} </li>
<li> {{ object.year_published}} </li>
<li> {{ object.ISBN}} </li>
<li> {{ object.blurb}} </li>
</ul>
<div>
<a href="/home">Home</a>
<a href="/books">Books</a>
<a href="/authors">Authors</a>
{% endblock %}
{% extends 'base.html' %}
{% block title%} My favorite books {% endblock %}
{% block additional %} <h1> Neptune's favorite books</h1> {% endblock %}
{% block content %}
<ol>
{% for obj in object_list %}
<li><a href="{{obj.get_absolute_url}}/details/">{{ obj.title }}</a></li>
{% endfor %}
</ol>
<div>
<a href="/home">Home</a>
<a href="/authors">Authors</a>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %} My favorite Books and Authors {% endblock %}
{% block additional %} <h1> Welcome to Neptune's database of favorite books and authors</h1> {% endblock %}
{% block content %}
<p>My taste in books are very random and usually done in the spur of the moment. I cannot commit to a series. </p>
<div>
<a href="/books">Books</a>
<a href="/authors"> Authors</a>
</div>
{% endblock %}
...@@ -5,7 +5,7 @@ from .views import (homeView, BooksView, BooksDetail) ...@@ -5,7 +5,7 @@ from .views import (homeView, BooksView, BooksDetail)
urlpatterns = [ urlpatterns = [
path('home/', homeView, name='home'), path('home/', homeView, name='home'),
path('books/', BooksView.as_view(), name="books"), path('books/', BooksView.as_view(), name="books"),
path('books/<int:pk>/details', BooksDetail.as_view(), name="book_details") 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
......
...@@ -14,4 +14,4 @@ class BooksView(ListView): ...@@ -14,4 +14,4 @@ class BooksView(ListView):
class BooksDetail(DetailView): class BooksDetail(DetailView):
model = Book model = Book
template_name = "bookshelf/bookDetais.html" template_name = "bookshelf/book_detais.html"
...@@ -14,8 +14,9 @@ Including another URLconf ...@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('',include('bookshelf.urls', namespace='bookshelf'))
] ]
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