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

Fixed unnecessary code in author_detail.

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