Django

Code

Ticket #3370: models.py.diff

File models.py.diff, 0.7 kB (added by Esaj, 2 years ago)

Another possible fix.

  • django/newforms/models.py

    old new  
    2929    opts = instance.__class__._meta 
    3030    if form.errors: 
    3131        raise ValueError("The %s could not be changed because the data didn't validate." % opts.object_name) 
    32     clean_data = form.clean_data 
     32    clean_data = dict([ 
     33        (k, isinstance(v, unicode) and v.encode(settings.DEFAULT_CHARSET) or v) 
     34        for k, v in form.clean_data.items() 
     35    ]) 
    3336    for f in opts.fields: 
    3437        if isinstance(f, models.AutoField): 
    3538            continue