Commit 1cf0bf9b authored by Jose Gabriel L. Salas's avatar Jose Gabriel L. Salas

renamed bookshelf templates files

parent 4a34477b
......@@ -13,9 +13,11 @@
<br>
<h>Books by {{ object }} I love:</h>
<br>
<li>
<a href="/bookshelf/books/{{ object.books.get_absolute_url }}">{{ object.books.title }}</a>
</li>
{% for book in books %}
{% if book.author == object %}
<a href="{{ book.get_absolute_url }}">{{ book.title }}</a>
{% endif %}
{% endfor %}
<br>
<a href="/bookshelf/home/">Home</a>
<a href="/bookshelf/books/">Books</a>
......
......@@ -6,17 +6,25 @@ from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
def index(request):
return render(request, 'home.html', {'name': 'Gab'})
return render(request, 'bookshelf/home.html', {'name': 'Gab'})
class BooksListView(ListView):
model = Books
template_name = "bookshelf/books.html"
class BooksDetailView(DetailView):
model = Books
template_name = "bookshelf/book_details.html"
class AuthorListView(ListView):
model = Author
template_name = "bookshelf/authors.html"
class AuthorDetailView(DetailView):
model = Author
\ No newline at end of file
model = Author
template_name = "bookshelf/author_details.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['books'] = Books.objects.all()
return context
\ 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