Opened 17 years ago

Closed 17 years ago

#5810 closed (fixed)

Form subclass trying to override parent form field

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

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 by Matt McClanahan, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in [6668].

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