1👍
✅
InlineModelAdmin
extra
‘s default value is 3
, so you can simply change it extra = 0
in PenInline
declaration:
class PenInline(admin.TabularInline):
model = Pen
extra = 0
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.extra
Or look at https://stackoverflow.com/a/2228821/3033586
Or remove ColorAdmin
declaration and change last line to admin.site.register(Color)
Source:stackexchange.com