Opened 7 years ago

Closed 7 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: UI/UX:

Description

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 7 years ago by brosner

  • milestone 1.0 beta deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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