-
Notifications
You must be signed in to change notification settings - Fork 0
/
listview.html
66 lines (52 loc) · 2.03 KB
/
listview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% extends "pagination/base.html" %}
{% block content %}
<div class = "card mb-4">
<div class = "card-header">
<form action="{% url 'listview' %}" method="GET">
{{ filter_form.as_p }}
<div class="form-group">
<button class="btn btn-info" type="submit">Filter</button>
</div>
</form>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
<h3>History</h3>
</div>
{% for post in forms %}
<div class="card-body mb-4">
<article class="media article-section">
<div class="media-body">
<div class="article-metadata">
<a class="mr-2" href="#">{{ post.id }}</a> <b>{{ post.name }} </b>
</div>
<small>{{ post.due_date }}</small>
<hr>
<b>Comments</b>
<p>{{ post.text }}</p>
<hr>
</div>
</article>
</div>
{% endfor %}
</div>
{% if is_paginated %}
{% if page_obj.has_previous %}
<a class="btn btn-outline-info mb-4" href="?page=1&{{ get_copy.urlencode }}">First</a>
<a class="btn btn-outline-info mb-4" href="?page={{ page_obj.previous_page_number }}&{{ get_copy.urlencode }}">Previous</a>
{% endif %}
{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<a class="btn success mb-4" href="?page={{ num }}&{{ get_copy.urlencode }}">{{ num }}</a>
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
<a class="btn btn-outline-info mb-4" href="?page={{ num }}&{{ get_copy.urlencode }}">{{ num }}</a>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<a class="btn btn-outline-info mb-4" href="?page={{ page_obj.next_page_number }}&{{ get_copy.urlencode }}">Next</a>
<a class="btn btn-outline-info mb-4" href="?page={{ page_obj.paginator.num_pages }}&{{ get_copy.urlencode }}">Last</a>
{% endif %}
{% endif %}
{% endblock content %}