I have the following two classes declared in admin Django files. On the admin panel 3 inline inputs are shown, I only want to show 1 input. Any guesses on why 3 inline inputs are shown instead of just one?
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'
)
On your admin add:
extra=0
that will fix this behavior
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.