did some optimisation

This commit is contained in:
MassiveAtoms
2020-07-11 14:56:22 -03:00
parent c00b2b0e52
commit 58d4f27c61
9 changed files with 439 additions and 31 deletions

View File

@ -39,7 +39,7 @@
</button>
<div class="dropdown-container">
{% for author in unique_authors %}
<a href="{{author.get_absolute_url}}">{{author}}</a>
<a href="{{author.get_absolute_url}}">{{author.name}}({{author.num_books}})</a>
{% endfor %}
</div>
@ -49,7 +49,7 @@
</button>
<div class="dropdown-container">
{% for publisher in unique_publishers %}
<a href="{{publisher.get_absolute_url}}">{{publisher}}</a>
<a href="{{publisher.get_absolute_url}}">{{publisher}} ({{publisher.num_books}})</a>
{% endfor %}
</div>
@ -59,7 +59,7 @@
</button>
<div class="dropdown-container">
{% for rating in unique_ratings %}
<a href="{{rating.get_absolute_url}}">{{rating}}</a>
<a href="{{rating.get_absolute_url}}">{{rating}} ({{rating.num_books}})</a>
{% endfor %}
</div>
@ -68,7 +68,7 @@
</button>
<div class="dropdown-container">
{% for tag in unique_tags %}
<a href="{{tag.get_absolute_url}}">{{tag}}</a>
<a href="{{tag.get_absolute_url}}">{{tag}} ({{tag.num_books}})</a>
{% endfor %}
</div>

View File

@ -0,0 +1,40 @@
{% extends "base.html" %}
{% block content %}
{% load static %}
<h1>Results</h1>
<table id="books">
<tr>
<!--When a header is clicked, run the sortTable function, with a parameter, 0 for sorting by names, 1 for sorting by country:-->
<th onclick="sortTable(0)">Title</th>
<th onclick="sortTable(1)">Author</th>
<th onclick="sortTable(2)">Rating</th>
<th onclick="sortTable(3)">Tags</th>
<th onclick="sortTable(4)">Added</th>
</tr>
{% for book in book_list %}
<tr>
<td><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></td>
<td>{{book.author_sort}}</td>
<td> {% for rating in book.ratings.all %}
{{rating}}
{% endfor %}
</td>
<td>
{% for tag in book.tags.all %}
{{tag}},
{% endfor %}
</td>
<td>{{book.timestamp}}</td>
</tr>
{% endfor %}
</table>
{% endblock %}