开发者

Overriding Django Admin's main page? - Django

开发者 https://www.devze.com 2022-12-31 04:50 出处:网络
I\'m trying to add features to Django 1.2 admin\'s main page. I\'ve been playing with index.html, but features added to this page affect all app pages.

I'm trying to add features to Django 1.2 admin's main page.

I've been playing with index.html, but features added to this page affect all app pages.


Any ideas on what template I'm sup开发者_StackOverflow中文版posed to use?

Thanks loads!!


You can use template hierarchy like:

index.html

...
{% block content %}
...
{% block mycontent %}My custom text{% endblock %}
...
{% endblock %}

app_index.html

...
    {% block mycontent %}{% endblock %}
..


According to http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template you will want to override admin/app_index.html


I have done this by modifying the admin/index.html template. You may also need to modify admin/base_site.html (depending on what you want to do, exactly).

These templates are found in the django/contrib/admin/templates/admin folder in a Django installation.

Update: That's exactly what I've done, see the screenshot fragment below. The section marked in red is the section I added, via HTML in admin/index.html. However, you don't say which version of Django you're using - my example is from a 1.0 installation.

Overriding Django Admin's main page? - Django

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号