django-forms-8

Last Updated :
Discuss
Comments

Which method safely renders only selected fields in a ModelForm?

Use Meta.fields = 'all' and hide unwanted fields with CSS

Use Meta.fields = ['required_field1', 'required_field2']

Modify init to remove unwanted fields

Use Meta.exclude = ['field_x', 'field_y']

Tags:
Share your thoughts in the comments