I wrote this django 1.7.7 code:
class Color(models.Model):
color = models.CharField(max_length=20, primary_key=True)
def __unicode__(self):
return str(self.color)
class Pen(models.Model):
label = models.CharField(max_length=20, primary_key=True)
color = models.ForeignKey('Color')
class PenAdmin(admin.ModelAdmin):
pass
class PenInline(admin.TabularInline):
model = Pen
class ColorAdmin(admin.ModelAdmin):
inlines = [PenInline,]
admin.site.register(Pen, PenAdmin)
admin.site.register(Color, ColorAdmin)
I want to know why when I click on the add color button in the admin page, it also shows 3 pen fields as in the image below and how to remove them from that specific dialog. I've tried both TabularInline and StackedInline and they look identical.