Ticket #3632: forms.2.diff

File forms.2.diff, 720 bytes (added by ludo@…, 18 years ago)

revised patch

  • newforms/forms.py

     
    4646            if hasattr(base, 'base_fields'):
    4747                fields = base.base_fields.items() + fields
    4848
    49         attrs['base_fields'] = SortedDictFromList(fields)
     49        # preserve initial values
     50        base_fields = SortedDictFromList(fields)
     51        for k, v in attrs.get('base_fields', dict()).items():
     52            if k in base_fields:
     53                base_fields[k].initial = v.initial
     54        attrs['base_fields'] = base_fields
    5055        return type.__new__(cls, name, bases, attrs)
    5156
    5257class BaseForm(StrAndUnicode):
Back to Top