在 Django 管理仪表板中将 Django Flatpage Label 更改为另一个名称
我对 django 很陌生,我正在尝试在我要创建的网站之一中使用平面模块。我可以为管理员用户设置所有内容,以使用 Flatpage 模块创建页面,但现在的问题是我想使用对最终用户有意义的内容更改管理仪表板上显示的 Flatpages 名称。例如,“管理静态页面”之类的名称或类似名称。从文档中我可以理解 META 类是需要用来更改标签的类,但我不确定如何使用它以及在哪里使用它。请帮我。谢谢
Am pretty new to django and am trying to make use of the flatpage module in one of the site am going to create. I am able to setup everything for an admin user to create a page using the flatpage module, but the problem now is that I want to change the Flatpages name thats displayed on the admin dashboard with something sensible for an end user. For example, a name like 'Manage Static Pages' or something like that. From the documents I could understand that META class is what one need to use to change the label but i am not sure how to use it and where to use it. Please help me. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 Django 也很陌生,但这是我的尝试:
在您的 models.py 中,您需要重写 FlatPage 模型,为其提供您自己的 Meta 类,因此您应该执行如下操作
:您的模型的名称将显示在管理中。然后您必须注册它才能出现在管理员中。
然后你就应该设置好了!同样,有人可能能够提供更好的答案。我还在学习!
I am very new to Django, too, but here is my attempt:
In your models.py, you need to override the FlatPage model, to provide your own Meta class for it, so you should do something like the below:
This sets up the name for your model which will appear in the admin. You then have to register it to appear in the admin.
You should then be set! Again, someone may be able to chime in with a better answer. I'm still learning!