Ticket #3632: forms.py.2.diff

File forms.py.2.diff, 792 bytes (added by empty <mtrier@…>, 7 years ago)

Updated because SortedDictFromList was removed

  • newforms/forms.py

     
    3838            if hasattr(base, 'base_fields'):
    3939                fields = base.base_fields.items() + fields
    4040
    41         attrs['base_fields'] = SortedDict(fields)
     41        # preserve initial values
     42        base_fields = SortedDict(fields)
     43        if attrs.get('base_fields'):
     44            base_fields = base_fields.copy()
     45            for k, v in attrs.get('base_fields').items():
     46                if k in base_fields:
     47                    base_fields[k].initial = v.initial
     48        attrs['base_fields'] = base_fields
    4249        return type.__new__(cls, name, bases, attrs)
    4350
    4451class BaseForm(StrAndUnicode):
Back to Top