Skip to content

Instantly share code, notes, and snippets.

@mdaizovi
Last active July 25, 2019 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdaizovi/d86de8fea0f342af960c2c5eb59e57a0 to your computer and use it in GitHub Desktop.
Save mdaizovi/d86de8fea0f342af960c2c5eb59e57a0 to your computer and use it in GitHub Desktop.
Overriding the django admin template to create Back/Forward (or Next/Previous) buttons (1 of 2)
<!-- templates/admin/pagination.html -->
{% load admin_list %}
{% load i18n %}
{% load content_extras %}
<p class="paginator">
{% if pagination_required %}
{% for i in page_range %}
{% if forloop.first %}
{% back_url cl i %}
{% endif %}
{% paginator_number cl i %}
{% if forloop.last %}
{% forward_url cl i %}
{% endif %}
{% endfor %}
{% endif %}
{{ cl.result_count }} {% if cl.result_count == 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endif %}
{% if show_all_url %}&nbsp;&nbsp;<a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %}
{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>{% endif %}
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment