如何在Django中创建自定义的管理配置面板? [英] How to create a custom admin configuration panel in Django?

查看:92
本文介绍了如何在Django中创建自定义的管理配置面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为使用Django设计的网络应用程序的主页创建一个配置面板。
此配置面板应该让我选择一些基本选项,如突出显示一些消息,设置一个展示横幅等等。
基本上,我不需要一个不同行的应用程序,只是一个带有一些配置选项的面板页面。
Django创建的自动生成的管理区域似乎没有处理这个功能,只要我看到,所以我问你一些方向。
任何提示都非常感激。
谢谢你提前。

I would like to create a configuration panel for the homepage of the web-app I'm designing with Django. This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on. Basically I don't need an app with different rows, but just a panel page with some configuration options. The automatically generated administration area created by Django doesn't seem to handle this feature as far as I can see, so I'm asking you for some directions. Any hint is highly appreciated. Thank you in advance.

Matteo

推荐答案

Django的管理区域与Django其他站点的视图和模板一样,只需要自定义相关文件即可。

The admin area of Django features views and templates just like the rest of your Django site, so it's just a matter of customizing the relevant files.

这应该是一个有用的阅读。

特别地,可以在django / contrib / admin / sites.py中找到引用索引页面的方法,并且可以在django / contrib / admin / templates / admin中找到实际的索引页面。而不是直接修改这些内容,您应该按照上述链接进行复制。

In particular, the method that renders the index page can be found in django/contrib/admin/sites.py, and the actual index page can be found in django/contrib/admin/templates/admin. Instead of modifying these directly, you should make copies as the above link explains.

从那里只是编写相关代码来显示新闻部分。如果你想要的话,你可以通过另一个应用程序,或者甚至可以使用XML或其他选择的其他网站获取数据。

From there it's just a matter of writing the relevant code to display the news section. You can make the news another app if you want, or you can even get the data from another website using XML or something else of your choice.

这篇关于如何在Django中创建自定义的管理配置面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆