Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit Django User admin template

I need to edit the template shown for editing a specific user. I need to display some additional data that doesn't fit in with an include-style.

I apologise for the short question... but that's pretty much all there is at the moment.

like image 534
Oli Avatar asked Dec 19 '25 08:12

Oli


1 Answers

If you can't accomplish what you want with just subclassing admin.ModelAdmin, you can create a directory "admin/auth" in your template directory and put a "change_form.html" in there. In this template you can override blocks that are available e.g. {% block after_related_objects %}.

Have a look at django/contrib/templates/admin/change_form.html to see how they do stuff, e.g.:

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="../../../jsi18n/"></script>
{{ media }}
{% endblock %}

appending stuff to the extrahead block.

like image 91
stefanw Avatar answered Dec 22 '25 01:12

stefanw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!