maykinmedia / django-admin-index

Change the Django admin index page without too much hassle or visual changes.
BSD 3-Clause "New" or "Revised" License
89 stars 10 forks source link

NoReverseMatch error when using overwritten admin page #86

Open felixsc1 opened 1 year ago

felixsc1 commented 1 year ago

In my Django project, I have overwritten the default admin site, and this breaks the django-admin-index

NoReverseMatch at /admin/mymodel/
Reverse for 'app_list' with keyword arguments '{'app_label': 'admin_index'}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>mymodel)/$']

...
Error during template rendering
In template /home/felix/GitRepos/showcase/venv/lib/python3.10/site-packages/django_admin_index/templates/django_admin_index/includes/app_list.html, error at line 3

Reverse for 'app_list' with keyword arguments '{'app_label': 'admin_index'}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>mymodel)/$']
1   {% load i18n django_admin_index static %}
2   
3   {% dashboard_app_list as dashboard_app_list %}
4   {% display_dropdown_menu request as should_display_dropdown %}
5   
6   {% if dashboard_app_list and should_display_dropdown %}
7       <div class="djai-dropdown-menu">
8           {% url 'admin:index' as home %}
9           <a href="{{ home }}"
10             class="djai-dropdown-menu__item {% if request.path == home %}djai-dropdown-menu__item--active{% endif %}">
11              {% trans "Dashboard" %}
12          </a>
13          {% for app in dashboard_app_list %}
sergei-maertens commented 1 year ago

I'm curious how that works with regular Django then? As far as I can see, Django's own templates also use this explicit namespace, looking at django/contrib/admin/templates/admin/change_form.html for example:

{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>