开发者

Radical Use of Admin's Interface

I was wondering....

Is it possible in Django the creation of an Admin page completely independent of a model or even a app?

开发者_开发百科I was thinking in something like a dashboard or interface of control, that only gather data from other models but does not have it's own.

If so, any further reference or link?

Thanks


As what Ben said, you can do this by creating a view function for your dashboard page. The view function itself can live anywhere within your project, but Django needs to know where it is (i.e. unlike the Django's default model admin views, you need to define your view in a urls.py file that is known to Django).

One thing to add, since I'm assuming that this dashboard page is only accessible via your admin interface, you want to secure it using some of the built-in authentication decorators (e.g. login_required or permission_required).


It is entirely possible to do this. You can do this with regular views, and then create templates that extend the "admin/base_site.html" template like so:

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

You can also do breadcrumbs like this:

{% block breadcrumbs %}{% if not is_popup %}
    <div class="breadcrumbs">
         <a href="/admin/">Home</a> &rsaquo;
         <a href="/admin/yourpath/">Up One Level</a> &rsaquo; 
         You Are Here
    </div>
{% endif %}{% endblock %}

And then put whatever content you want inside of the "content" block.


I'm using django-admin-tools for creating dashboards. It is quite easy to create custom dashboard modules with this app.

There is also an another app (nexus) with similar purposes. I haven't tried it by myself but it looks good too.


Nexus seems like just the right thing. I am using it myself and its very useful. As of kow there are not alot of moudles availale, only two i think. It was made by the guys behind Disqus

Link: Nexus

There are going to add documentation on how to add your own modules.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜