Ticket #10404: 10404.diff

File 10404.diff, 3.0 KB (added by anonymous, 6 years ago)
  • django/db/models/base.py

    diff --git a/django/db/models/base.py b/django/db/models/base.py
    index 05cd0d9..7bb9260 100644
    a b class Model(object): 
    458458                        manager.filter(pk=pk_val).extra(select={'a': 1}).values('a').order_by())):
    459459                    # It does already exist, so do an UPDATE.
    460460                    if force_update or non_pks:
    461                         values = [(f, None, (raw and getattr(self, f.attname) or f.pre_save(self, False))) for f in non_pks]
     461                        [(f, None, (raw and getattr(self, f.attname) or f.pre_save(self, False))) for f in non_pks]
     462                        values = [(f, None, (getattr(self, f.attname))) for f in non_pks]
    462463                        rows = manager.filter(pk=pk_val)._update(values)
    463464                        if force_update and not rows:
    464465                            raise DatabaseError("Forced update did not affect any rows.")
    class Model(object): 
    468469                if not pk_set:
    469470                    if force_update:
    470471                        raise ValueError("Cannot force an update in save() with no primary key.")
    471                     values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields if not isinstance(f, AutoField)]
     472                    [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields if not isinstance(f, AutoField)]
     473                    values = [(f, f.get_db_prep_save(getattr(self, f.attname))) for f in meta.local_fields if not isinstance(f, AutoField)]
    472474                else:
    473                     values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields]
     475                    [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields]
     476                    values = [(f, f.get_db_prep_save(getattr(self, f.attname))) for f in meta.local_fields]
    474477
    475478                if meta.order_with_respect_to:
    476479                    field = meta.order_with_respect_to
  • tests/modeltests/model_forms/models.py

    diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
    index c5795b7..7c7da67 100644
    a b try: 
    112112            return '%s/%s' % (path, filename)
    113113
    114114        description = models.CharField(max_length=20)
    115         image = models.ImageField(storage=temp_storage, upload_to=custom_upload_path,
    116                                   width_field='width', height_field='height')
    117115        width = models.IntegerField(editable=False)
    118116        height = models.IntegerField(editable=False)
     117        image = models.ImageField(storage=temp_storage, upload_to=custom_upload_path,
     118                                  width_field='width', height_field='height')
    119119        path = models.CharField(max_length=16, blank=True, default='')
    120120
    121121        def __unicode__(self):
Back to Top