add search
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
<div class="col-sm-2">
|
||||
{% block sidebar %}
|
||||
<div class="sidenav">
|
||||
<a href="{% url 'search' %}">Search</a>
|
||||
<a href="{% url 'books' %}">Books</a>
|
||||
<button class="dropdown-btn">Authors
|
||||
<i class="fa fa-caret-down"></i>
|
||||
|
40
CalibreWebCompanion/library/templates/results.html
Normal file
40
CalibreWebCompanion/library/templates/results.html
Normal 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 books_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 %}
|
15
CalibreWebCompanion/library/templates/search.html
Normal file
15
CalibreWebCompanion/library/templates/search.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
<form action="{% url 'results' %}" method="get">
|
||||
<label for="title">Title: </label>
|
||||
<input id="title" type="text" name="title" value="">
|
||||
<label for="author">Author: </label>
|
||||
<input id="author" type="text" name="author" value="">
|
||||
<input type="submit" value="search">
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user