Django

Code

Ticket #6500: 0055-Make-models-hashable.patch

File 0055-Make-models-hashable.patch, 0.8 kB (added by Bastian Kleineidam <calvin@debian.org>, 7 months ago)
  • a/django/db/models/base.py

    old new  
    110110    def __ne__(self, other): 
    111111        return not self.__eq__(other) 
    112112 
     113    def __hash__ (self): 
     114        return hash(self._get_pk_val()) 
     115 
    113116    def __init__(self, *args, **kwargs): 
    114117        dispatcher.send(signal=signals.pre_init, sender=self.__class__, args=args, kwargs=kwargs) 
    115118