Hello!
Django ModelAdmin class has a nice way to create custom admin views with get_urls(). What is missing however is a way to expose them in the admin index page.
Frank Wiles created the (now abandoned) django-admin-views package [1] as a workaround and there are many questions regarding this in StackOverflow [2][3][4][5].
What do you think about exposing custom views in admin index page via a new ModelAdmin.extra_views attribute?
extra_views would be a list of dictionaries/objects with 'url' and 'name' fields.
They would be visible in the index page with the following change to django/contrib/admin/templates/admin/index.html:
--- ../venv/Lib/site-packages/django/contrib/admin/templates/admin/index.html 2019-02-28 01:22:12.767388100 +0200
+++ templates/admin/index.html 2019-03-06 12:57:22.070586600 +0200
@@ -43,6 +43,15 @@
<td> </td>
{% endif %}
</tr>
+ {% if model.extra_views %}
+ {% for view in model.extra_views %}
+ <tr>
+ <th scope="row"><a href="{{ view.url }}">{{
view.name }}</a></th>
+ <td> </td>
+ <td> </td>
+ </tr>
+ {% endfor %}
+ {% endif %}
{% endfor %}
</table>
</div>
Best regards,
Mart
---