开发者

Adding views to the Django admin

开发者 https://www.devze.com 2023-04-02 04:11 出处:网络
Is there a way 开发者_Go百科to add custom views to the Django admin app? To be specific, I would like to be able to switch out the \"content\" div for custom static content, while preserving the \"he

Is there a way 开发者_Go百科to add custom views to the Django admin app?

To be specific, I would like to be able to switch out the "content" div for custom static content, while preserving the "header" and "footer" divs. This is different than redirecting to a static HTML page, which would not preserve the header and footer.


You just configure your view as usual (urls.py -> myapp.views) and then extend the admin base template:

{% extends "admin/base_site.html" %}
{% block content %}
    My content looking like the rest of the admin app.
{% endblock %}


Here is a small intro http://www.djangobook.com/en/1.0/chapter17/, I think where is new version, but I think where is nothing changed in concept of extending admin pages.

0

精彩评论

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