1+ {% extends 'base.html' %}
2+ {% block content %}
3+ < a href ="{% url 'locations:adauga' %} " class ="btn btn-success "> Adauga locatie</ a >
4+ < br >
5+ < table class ="table ">
6+ < thead >
7+ < tr >
8+ < th > Index</ th >
9+ < th > City</ th >
10+ < th > Country</ th >
11+ < th > Stare</ th >
12+ < th > Actions</ th >
13+ </ tr >
14+ </ thead >
15+ < tbody >
16+ {% for item in locations_list %}
17+ < tr >
18+ < td > {{ forloop.counter0|add:page_obj.start_index }}</ td >
19+ < td > {{ item.city }}</ td >
20+ < td > {{ item.country }}</ td >
21+ < td > {% if item.active == 1 %}
22+ < span > Activ</ span >
23+ {% else %}
24+ < span > Inactiv</ span >
25+ {% endif %}
26+ </ td >
27+ < td >
28+ < a href ="{% url 'locations:modifica' item.id %} " class ="btn btn-success "> Modifica</ a >
29+ {% if item.active == 1 %}
30+ < a href ="{% url 'locations:sterge' item.id %} " class ="btn btn-danger "> Sterge</ a >
31+ {% else %}
32+ < a href ="{% url 'locations:activeaza' item.id %} " class ="btn btn-info "> Activeaza</ a >
33+ {% endif %}
34+ </ td >
35+ </ tr >
36+ {% endfor %}
37+ </ tbody >
38+ </ table >
39+ < div class ="d-flex align-items-center ">
40+ {% if is_paginated %}
41+ < ul class ="pagination ">
42+ {% if page_obj.has_previous %}
43+ < li > < a class ="btn " href ="?page={{ page_obj.previous_page_number }} "> < < </ a > </ li >
44+ {% else %}
45+ < li class ="disabled btn "> < span > < < </ span > </ li >
46+ {% endif %}
47+ {% for i in paginator.page_range %}
48+ {% if page_obj.number == i %}
49+ < li class ="active btn btn-info "> < span > {{ i }}< span class ="sr-only "> (curent)</ span > </ span > </ li >
50+ {% else %}
51+ < li > < a class ="btn " href ="?page={{ i }} "> {{ i }}</ a > </ li >
52+ {% endif %}
53+ {% endfor %}
54+ {% if page_obj.has_next %}
55+ < li > < a class ="btn " href ="?page={{ page_obj.next_page_number }} "> > > </ a > </ li >
56+ {% else %}
57+ < li class ="disabled btn "> < span > > > </ span > </ li >
58+ {% endif %}
59+ < span class ="align-right "> Showing {{ page_obj.start_index }} - {{ page_obj.end_index }} of
60+ {{ page_obj.paginator.count }}
61+ </ span >
62+ </ ul >
63+ {% endif %}
64+ </ div >
65+ {% endblock %}
0 commit comments