Ticket #15907: 15907_patch.diff

File 15907_patch.diff, 1.0 KB (added by leonelfreire, 14 years ago)

Patch that fixes this bug.

  • django/forms/models.py

     
    384384    # creating needs to inherit from the parent's inner meta.
    385385    parent = (object,)
    386386    if hasattr(form, 'Meta'):
     387        if 'fields' in attrs and hasattr(form.Meta, 'fields'):
     388            all_fields = tuple(attrs['fields']) + tuple(form.Meta.fields)
     389            attrs['fields'] = tuple(set(all_fields))
     390
     391        if 'exclude' in attrs and hasattr(form.Meta, 'exclude'):
     392            all_exclude = tuple(attrs['exclude']) + tuple(form.Meta.exclude)
     393            attrs['exclude'] = tuple(set(all_exclude))
    387394        parent = (form.Meta, object)
    388395    Meta = type('Meta', parent, attrs)
    389396
     
    10221029        if hasattr(value, '__iter__'):
    10231030            return [super(ModelMultipleChoiceField, self).prepare_value(v) for v in value]
    10241031        return super(ModelMultipleChoiceField, self).prepare_value(value)
     1032
Back to Top