我在admin Django文件中声明了以下两个类。在管理面板上显示了3个内联输入,我只想显示1个输入。有关为什么显示3个内联输入而不仅仅是一个的猜测?
class OriginURLInline(ViewPermissionMixin, admin.StackedInline):
model=IncentiveReferrerURL
verbose_name = 'Promotion URL'
verbose_name_plural = 'Promotion link'
fields = ('origin_url',)
class IncentiveReferrerURL(TimeStampedModel):
# The TimeStampedModel will provide self-updating 'created' and 'modified' fields on the inherited model
incentive = models.ForeignKey(
Incentive,
on_delete=models.PROTECT,
null=True,
blank=True,
)
origin_url = models.CharField(
max_length = 100,
verbose_name = 'Promotion Name:',
help_text='Please e'
)
答案 0 :(得分:0)
在您的管理员添加:
extra=0
将解决此问题