[Fixed]-Adding reports to Django's admin

6👍

The above answer didn’t address question 2, at least directly… the “hack” way to get your custom view to show up as the front page of the admin is probably to just override it in the urlconf:

(r'^admin/$', my.custom.admin.homepage),

before the normal admin line:

(r'^admin/', admin.site.root),

the “right” way to do it, though, is to make your admin a custom instance of AdminSite and override the index_template setting. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#root-and-login-templates

4👍

In terms of generating the look and feel of admin, it should be trivial to inherit the parent pages of the admin and insert your own template content into the appropriate blocks.

Take a look at the markup (including id and class attributes) in the default admin pages and try to get an understanding of how things are styled consistently. If you are including the admin CSS on the page you should get an awful lot of it for free.

For further information, take a look at the admin docs: http://docs.djangoproject.com/en/dev/ref/contrib/admin/

2👍

Here’s a base template to get you started:

    {% extends "admin/base_site.html" %}
    {% load adminmedia %}

    {% block extrahead %}
    {% endblock %}
    {% block coltype %}flex{% endblock %}
    {% block bodyclass %}change-list{% endblock %}
    {% block stylesheet %}{% admin_media_prefix %}css/changelists.css{% endblock %}
    {% block extrastyle %}
    <link rel="stylesheet" type="text/css" href="{{settings.MEDIA_URL}}/stylesheets/extra_admin.css" />
    {% endblock %}
    {% block breadcrumbs %}<div class="breadcrumbs"><a href="/admin/">Home</a>&nbsp;&rsaquo;&nbsp;{{page_title}}</div>{% endblock %}
    {% block content %}
    <div id="content-main">
        <h1>{{page_title}}</h1>
        {{page_content}}
    </div>
    {% endblock %}

Leave a comment