Commit 9ad680e5 authored by Alliyah Marcelo's avatar Alliyah Marcelo

Fixed unnecessary code in author_detail.

parent 00292826
......@@ -14,15 +14,11 @@
<br><br>
Books by {{ object }} I love:
<br>
<ul>
{% for book in books_list.html %}
{% if book.author == object %}
<li>
<a href="{{ book.get_absolute_url }}">{{ book.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% for book in books %}
{% if book.author == object %}
<a href="{{ book.get_absolute_url }}">{{ book.title }}</a>
{% endif %}
{% endfor %}
<br><br>
<a href="/bookshelf/home/">Home</a>
<a href="/bookshelf/books/">Books</a>
......
......@@ -22,4 +22,9 @@ class AuthorListView(ListView):
class AuthorDetailsView(DetailView):
model = Author
\ No newline at end of file
model = Author
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