如何更改 Django 中 InlineModelAdmin 对象中显示的默认 3 个实例
当您在 Django 中定义 InlineModelAdmin
类时,默认情况下,它会在模型的管理页面中显示 3 个模型,这些模型具有我在类中定义的模型的外键。
如何更改它?
我只是不想使用 max_num
字段,因为使用它时,我将无法在页面中添加其他实例。
谢谢
When you define a InlineModelAdmin
class in Django, by default it shows 3 models in the admin page of the model that has a Foreign Key to the model I defined in the class.
How can I change that?
I just don't want to use max_num
field, because when using it, I won't be able to add another instances in the page.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
extra
代替max_num
:http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.extraInstead of
max_num
useextra
: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.extra