Ticket #9418: django-9418.diff

File django-9418.diff, 1.0 KB (added by Bernd Schlapsi, 16 years ago)

first patch-trail

  • django/forms/models.py

     
    4141        raise ValueError("The %s could not be %s because the data didn't"
    4242                         " validate." % (opts.object_name, fail_message))
    4343    cleaned_data = form.cleaned_data
     44    filefieldlist = []
    4445    for f in opts.fields:
    4546        if not f.editable or isinstance(f, models.AutoField) \
    4647                or not f.name in cleaned_data:
     
    4950            continue
    5051        if exclude and f.name in exclude:
    5152            continue
     53        if isinstance(f, models.FileField) or isinstance(f, models.ImageField):
     54            filefieldlist.append(f)
     55        else:
     56            f.save_form_data(instance, cleaned_data[f.name])
     57           
     58    for f in filefieldlist:
    5259        f.save_form_data(instance, cleaned_data[f.name])
     60       
    5361    # Wrap up the saving of m2m data as a function.
    5462    def save_m2m():
    5563        opts = instance._meta
Back to Top