Ticket #3703: pk_property.patch

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

     
    7777    def _get_pk_val(self):
    7878        return getattr(self, self._meta.pk.attname)
    7979
     80    def _set_pk_val(self, value):
     81        return setattr(self, self._meta.pk.attname, value)
     82
     83    pk = property(_get_pk_val, _set_pk_val)
     84
    8085    def __repr__(self):
    8186        return '<%s: %s>' % (self.__class__.__name__, self)
    8287
Back to Top