Allow Update/CreateView to have fields/exclude arguments
|Reported by:||linovia||Owned by:||linovia|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
The general idea behind generic views is to ease the development.
One of the issue I have found is that removing fields from the form leads to extra work by redefining another model form for that view.
class MilestoneForm(forms.ModelForm): class Meta: model = models.Milestone exclude = ('project', 'slug') class CreateMilestone(generic.CreateView): model = models.Milestone template_name_suffix = 's/new' form_class = MilestoneForm
whereas we could have a much simpler way:
class CreateMilestone(generic.CreateView): model = models.Milestone template_name_suffix = 's/new' exclude = ('project', 'slug')
Change History (5)
comment:1 Changed 5 years ago by
|Patch needs improvement:||unset|