Ticket #2936: add_hash_to_model.diff

File add_hash_to_model.diff, 529 bytes (added by favo@…, 9 years ago)

add hash to django.db.model.base

  • django/db/models/base.py

     
    8888    def __ne__(self, other):
    8989        return not self.__eq__(other)
    9090
     91    def __hash__(self):
     92        return hash(str(self._get_pk_val()))
     93
    9194    def __init__(self, *args, **kwargs):
    9295        dispatcher.send(signal=signals.pre_init, sender=self.__class__, args=args, kwargs=kwargs)
    9396        for f in self._meta.fields:
Back to Top