On Jun 18, 7:08 am, jurian <[EMAIL PROTECTED]> wrote:
> I recently ran in to the a problem/snag when overriding the admin
> index page. The thing is that I would like to change the index
> displayed for a specific application, and not the entire admin index.
>
> So I though that it might be a good idea to suggest a system where
> each application has a template (with the module list being the
> default) that gets displayed on the admin index page.
>
> This might also call for an option to override the main admin index
> page in order to change the way the various indices fit together
> (layout).
>
> Any comments or grunts of approval will be appreciated.

It's relatively simple to customise the admin homepage entirely.
Firstly, you can write your own view and use a urlconf that occurs
earlier than the admin one to cause it to be displayed instead (but
just for the homepage). Secondly, you can define your own admin
subclass and customise that. For example:

from django.contrib import admin

class MyAdmin(admin.AdminSite):
    # Use a different template for the admin homepage
    index_template = 'path/to/my/admin_index.html'

    def index(self, request):
        # You can write your own index logic here if you like
        # OR... you can add your own bits and pieces to the context
and
        # call the default admin view, like this:
        return super(MyAdmin, self).index(request, extra_context = {
            'extra_variable': 1,
        })

Does this give you the flexibility you need?

Cheers,

Simon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to