How to exclude Django Modelform fields
models.py
class Child(models.Model):
name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
grade = models.CharField(max_length=200)
admin.py
@admin.register(Child)
class ChildAdmin(admin.ModelAdmin):
exclude = ('grade',)
yields the same result as
@admin.register(Child)
class ChildAdmin(admin.ModelAdmin):
fields = ('name', 'last_name')