Django

Code

Changeset 8618

Show
Ignore:
Timestamp:
08/27/08 03:05:59 (10 months ago)
Author:
mtredinnick
Message:

Fixed #7289 -- Made ModelForms? behave like Forms in the sense that Field
objects don't appear as attributes on the final form instance. They continue to
appear as elements of the form_instance.fields mapping.

If you were relying on ModelForms? having fields as attributes, then this will
be slightly backwards incompatible. However, normal template usage will see no
change at all.

Patch from Daniel Pope.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/forms/models.py

    r8528 r8618  
    164164            # We are defining ModelForm itself. 
    165165            parents = None 
     166        declared_fields = get_declared_fields(bases, attrs, False) 
    166167        new_class = super(ModelFormMetaclass, cls).__new__(cls, name, bases, 
    167168                attrs) 
     
    171172        if 'media' not in attrs: 
    172173            new_class.media = media_property(new_class) 
    173         declared_fields = get_declared_fields(bases, attrs, False) 
    174174        opts = new_class._meta = ModelFormOptions(getattr(new_class, 'Meta', None)) 
    175175        if opts.model: