Django

Code

Ticket #7289: modelform_attribute_removal.diff

File modelform_attribute_removal.diff, 0.7 kB (added by Daniel Pope <dan@mauveinternet.co.uk>, 2 years ago)

Patch to allow get_declared_fields to remove fields from attrs

  • django/newforms/models.py

    old new  
    224224            return super(ModelFormMetaclass, cls).__new__(cls, name, bases, 
    225225                    attrs) 
    226226 
     227        declared_fields = get_declared_fields(bases, attrs, False) 
    227228        new_class = type.__new__(cls, name, bases, attrs) 
    228         declared_fields = get_declared_fields(bases, attrs, False) 
    229229        opts = new_class._meta = ModelFormOptions(getattr(new_class, 'Meta', None)) 
    230230        if opts.model: 
    231231            # If a model is defined, extract form fields from it.