Code Journal

6 thoughts
last posted July 28, 2016, 4:04 p.m.

5 earlier thoughts

0

In Django forms, you can either use exclude or fields to list a set of fields to exclude or include on the ModelForm.

I prefer to use fields to explicitly include fields on a form because it's easy to add fields to a model without thinking through it's use on a form somewhere in your project. However, if you are adding a field for the purpose of adding it to a form you'll have the form in mind so explicitly adding the field to the fields list will not be forgotten about.