Ticket #4102: save_fields.patch
File save_fields.patch, 688 bytes (added by , 18 years ago) |
---|
-
django/db/models/base.py
198 203 199 204 _prepare = classmethod(_prepare) 200 205 201 def save(self ):206 def save(self, save_fields=None): 202 207 dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self) 203 208 204 209 non_pks = [f for f in self._meta.fields if not f.primary_key] 210 if save_fields: 211 non_pks = [f for f in non_pks if f.name in save_fields] 205 212 cursor = connection.cursor() 206 213 207 214 # First, try an UPDATE. If that doesn't update anything, do an INSERT.