diff --git a/django/db/models/base.py b/django/db/models/base.py
index 05cd0d9..7bb9260 100644
|
a
|
b
|
class Model(object):
|
| 458 | 458 | manager.filter(pk=pk_val).extra(select={'a': 1}).values('a').order_by())): |
| 459 | 459 | # It does already exist, so do an UPDATE. |
| 460 | 460 | 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] |
| 462 | 463 | rows = manager.filter(pk=pk_val)._update(values) |
| 463 | 464 | if force_update and not rows: |
| 464 | 465 | raise DatabaseError("Forced update did not affect any rows.") |
| … |
… |
class Model(object):
|
| 468 | 469 | if not pk_set: |
| 469 | 470 | if force_update: |
| 470 | 471 | 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)] |
| 472 | 474 | 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] |
| 474 | 477 | |
| 475 | 478 | if meta.order_with_respect_to: |
| 476 | 479 | field = meta.order_with_respect_to |
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index c5795b7..7c7da67 100644
|
a
|
b
|
try:
|
| 112 | 112 | return '%s/%s' % (path, filename) |
| 113 | 113 | |
| 114 | 114 | 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') |
| 117 | 115 | width = models.IntegerField(editable=False) |
| 118 | 116 | height = models.IntegerField(editable=False) |
| | 117 | image = models.ImageField(storage=temp_storage, upload_to=custom_upload_path, |
| | 118 | width_field='width', height_field='height') |
| 119 | 119 | path = models.CharField(max_length=16, blank=True, default='') |
| 120 | 120 | |
| 121 | 121 | def __unicode__(self): |