Opened 10 years ago

Closed 10 years ago

#8152 closed (invalid)

Unable to override the "blank" attribute on fields when declaring a ModelForm

Reported by: davinstewart Owned by: nobody
Component: Forms Version: master
Severity: Keywords: ModelForm blank required
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When overriding field declarations in a ModelForm, the "blank" attribute cannot be overridden.

For example, in the following paraphrased code ...

class MyModel(models.Model):
    my_field = models.IntegerField(blank=True)

class MyForm(ModelForm):
    my_field = models.IntegerField(blank=False)

... when the form is validated, my_field should be flagged as being required but it's allowed to be blank.

Change History (1)

comment:1 Changed 10 years ago by Brian Rosner

milestone: 1.0 beta
Resolution: invalid
Status: newclosed

blank is not a valid keyword argument to a form field. Use required. Please ask questions of this nature on the django-users mailing list or in #django on freenode.

Note: See TracTickets for help on using tickets.
Back to Top