Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Fix Django 6.0 pagination error in jazzmin admin template#350

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-pagination-html-error
Draft

Fix Django 6.0 pagination error in jazzmin admin template#350
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-pagination-html-error

Conversation

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Django 6.0 changed format_html() to require formatting arguments. The jazzmin package (v3.0.1) calls format_html(html_str) without arguments, causing TypeError: args or kwargs must be provided on admin list views with pagination.

Changes

  • fix_jazzmin.sh: Automated patch script that replaces format_html(html_str) with mark_safe(html_str) in jazzmin's jazzmin_paginator_number template tag (line 256)
  • JAZZMIN_FIX_README.md: Documentation explaining the patch, deployment instructions, and why template tag override approaches don't work
  • core/tests_jazzmin_templatetag.py: Unit tests verifying the patched template tag works without errors

Implementation

The patch modifies the installed jazzmin package:

# Before (Django 6.0 incompatible)
return format_html(html_str)

# After (Django 6.0 compatible)
return mark_safe(html_str)

mark_safe() is appropriate here because the HTML is pre-formatted from Django's trusted ChangeList object. The patch must be reapplied after reinstalling/upgrading jazzmin until an official fix is released.

Run as part of deployment:

pip install -r requirements.txt
./fix_jazzmin.sh
Original prompt

This section details on the original issue you should resolve

<issue_title>/jazzmin/templates/admin/pagination.html, error at line 26</issue_title>
<issue_description>Environment:

Request Method: GET
Request URL: https://fi.angermeier.net/admin/core/booking/

Django Version: 6.0
Python Version: 3.12.12
Installed Applications:
['core',
'jazzmin',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'trading']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware']

Template error:
In template /opt/Finoa/.venv/lib/python3.12/site-packages/jazzmin/templates/admin/pagination.html, error at line 26
args or kwargs must be provided.
16 : {% if cl.formset and cl.result_count %}
17 :
18 : {% endif %}
19 :
20 :
21 :
22 :


23 :

    24 : {% if pagination_required %}
    25 : {% for i in page_range %}
    26 : {% jazzmin_paginator_number cl i %}
    27 : {% endfor %}
    28 : {% endif %}
    29 :

30 :

31 :

Traceback (most recent call last):
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 221, in _get_response
response = response.render()
^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
return template.render(context, self._request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
return self.template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 174, in render
return self._render(context)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 166, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1091, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1052, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 160, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 166, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1091, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1052, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 160, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 166, in _render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1091, in render
return SafeString("".join([node.render_annotated(context) for node in self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/Finoa/.venv/lib/python3.12/site-packages/django/template/base.py", line 1052, in render_annotated
return self.render(context)
...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 20, 2025 06:45
Co-authored-by: gdsanger <59723667+gdsanger@users.noreply.github.com>
Co-authored-by: gdsanger <59723667+gdsanger@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix template error in jazzmin pagination.html Fix Django 6.0 pagination error in jazzmin admin template Dec 20, 2025
Copilot AI requested a review from gdsanger December 20, 2025 06:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/jazzmin/templates/admin/pagination.html, error at line 26

2 participants