Ticket #4102: save_fields.patch

File save_fields.patch, 688 bytes (added by Collin Grady <cgrady@…>, 18 years ago)
  • django/db/models/base.py

     
    198203
    199204    _prepare = classmethod(_prepare)
    200205
    201     def save(self):
     206    def save(self, save_fields=None):
    202207        dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self)
    203208
    204209        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]
    205212        cursor = connection.cursor()
    206213
    207214        # First, try an UPDATE. If that doesn't update anything, do an INSERT.
Back to Top