Ticket #4239: forms.diff

File forms.diff, 832 bytes (added by ctdecci@…, 18 years ago)
  • django/newforms/forms.py

     
    3737    'base_fields', taking into account parent class 'base_fields' as well.
    3838    """
    3939    def __new__(cls, name, bases, attrs):
    40         fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
    41         fields.sort(lambda x, y: cmp(x[1].creation_counter, y[1].creation_counter))
     40        if attrs.has_key('base_fields'):
     41            fields = attrs['base_fields'].items()
     42        else:
     43            fields = []
    4244
    4345        # If this class is subclassing another Form, add that Form's fields.
    4446        # Note that we loop over the bases in *reverse*. This is necessary in
Back to Top