Opened 11 years ago
Closed 11 years ago
#22925 closed New feature (wontfix)
Provide ability to make ModelForm fields required by specifying them explicitly in Meta
| Reported by: | Andriy Sokolovskiy | Owned by: | Andriy Sokolovskiy |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Normal | Keywords: | modelform, form, required field |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I'm tired to always specify, which fields are must be required in that usual way:
self.fields['tag_line'].required = True
self.fields['cover'].required = True
self.fields['logo'].required = True
So I propose to add extra_required property to ModelForm Meta class.
A way to make fields required:
class Meta:
model = models.SomeModel
...
extra_required = ['tag_line', 'cover', 'logo']
Patch are in the attachments.
Attachments (1)
Change History (3)
by , 11 years ago
| Attachment: | extra_required.patch added |
|---|
comment:1 by , 11 years ago
I also created a pull request for this.
See https://github.com/django/django/pull/2862
comment:2 by , 11 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
While I somewhat like the idea, I'm going to won't fix this for reasons described in #17924 and https://code.djangoproject.com/ticket/20000#comment:9. Please open a thread on the DevelopersMailingList if you want to argue otherwise.
implements extra_required