views:

208

answers:

3

Hi folks,

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 supposed to use?

Thanks loads!!

+1  A: 

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.

Screenshot of customised admin page

Vinay Sajip
@Vinay thanks for the reply. I already override all those templates, but I just wish to add html to the "home" page, the page where all the apps and their models are listed
RadiantHex
@Vinay thank you so much for your great reply! I'm using Django 1.2, overriding index.html works nicely, but all App Indexes get overridden. I might have done something wrong.
RadiantHex
+1  A: 

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

Martin Eve
+1  A: 

You can use template hierarchy like:

index.html

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

app_index.html

...
    {% block mycontent %}{% endblock %}
..
Alex Isayko
@Alex: this is exactly how I fixed my problem!!! =)
RadiantHex