Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Use Pagination and Common based views.
For example:
Specify in views.py:
...
from django.views.generic import ListView
...
class RecordsListView(ListView):
template_name = 'record_list_view.html'
model = Record
paginate_by = 10
...
{% for record in object_list %}
...
{% endfor %}
{% if is_paginated %}
<div class="row">
<div class="col-sm-4">
<div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">
Показано с {{ page_obj.start_index }} по {{ page_obj.end_index }} из {{ page_obj.paginator.count }} результатов
</div>
</div>
<div class="col-sm-2">
<div class="dataTables_paginate paging_simple_numbers" id="dynamic-table_paginate">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="paginate_button previous" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'recordt_list'%}?page={{ page_obj.previous_page_number }}{{ search_data|set_search_data }}">Пред.</a>
</li>
{% else %}
<li class="paginate_button disabled previous" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'ticket_list'%}">Пред.</a>
</li>
{% endif %}
<li class="paginate_button active" aria-controls="dynamic-table" tabindex="0">
<a href="{% url record_list'%}?page={{page_obj.number}}{{ search_data|set_search_data }}">{{ page_obj.number }}</a>
</li>
{% if page_obj.has_next %}
<li class="paginate_button next" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'rtecord_list'%}?page={{ page_obj.next_page_number }}{{ search_data|set_search_data }}">След.</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'record_list'%}?page={{ page_obj.paginator.num_pages }}">След.</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endif %}
...
The author, dear users Denis Sh , Evgeny Borodenkov , Vladimir gave the right way and each according to his own understanding. but from your question it is not clear how you want to separate all this, why. in general, speaking the language of medicine, in order to make a diagnosis and give a prescription for treatment, you must actually at least understand what the patient is sick with. and your illness sounds like "here, doctor, my right hurts. give me a pill to fix everything"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question