Opened 8 years ago

Closed 8 years ago

#5810 closed (fixed)

Form subclass trying to override parent form field

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

Description

If a form subclass tries to override a parent form's field definition, the definition is overridden but the field is repeated.

class FormA(forms.Form):
    somefield = forms.AnyField(anyargs)

class FormB(FormA):
    somefield = forms.OtherField(otherargs)

FormB ends up with *two* somefields, both forms.Otherfield. This seems to me to be a bug in DeclarativeFieldsMetaclass's __new__ method - I think it should do some checking for duplicates round about as it adds fields to base_fields.

This is svn r6471.

Change History (1)

comment:1 Changed 8 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [6668].

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