django:扩展类的管理界面
我有两个类需要一个管理界面。但一个类扩展了另一个类。现在
class Questions(models.Model):
pass
class MathQuestion(Questions):
some fields ....
最简单的方法是为 MathQuestion 创建一个单独的管理员。但是,是否有可能我可以在管理中以更直观的方式显示 MathQuestion,例如:当用户转到 QuestionAdmin 界面并选择数学的其他类型时。
I have two classes for which I want an admin interface. But one class extends the other. Ex
class Questions(models.Model):
pass
class MathQuestion(Questions):
some fields ....
Now the simplest way is to create a separate admin for MathQuestion. However, is there a possibility that I can have MathQuestion displayed in a more intuitive fashio in Admin, ex: When user goes to QuestionAdmin interface and selects a further type for Maths.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
None
并且不可为空(这样您可以确定 Question 不能有实例,不确定它是否有效)save
子类中的方法,并为 Question_type 分配一些值,即 MathQuestion。None
and not nullable (so you can be sure Question can't have instances, not sure if it works)save
method in child class and assign there some value to question_type, meaning MathQuestion.