编辑Django用户管理模板 [英] 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.
推荐答案
如果你不能完成你想要的只是子类化 admin.ModelAdmin
,您可以在模板目录中创建一个目录admin / auth,并在其中放置一个change_form.html。在此模板中,您可以覆盖可用的块。 {%block after_related_objects%}
。
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 %}
.
查看 django / contrib / templates / admin / change_form.html
,看看他们如何做东西,例如:
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 %}
extrahead
block。
这篇关于编辑Django用户管理模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!