Changeset 7132
- Timestamp:
- 02/18/08 19:59:34 (5 months ago)
- Files:
-
- django/trunk/django/db/models/base.py (modified) (1 diff)
- django/trunk/tests/modeltests/basic/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/base.py
r7116 r7132 135 135 def __ne__(self, other): 136 136 return not self.__eq__(other) 137 138 def __hash__(self): 139 return hash(self._get_pk_val()) 137 140 138 141 def __init__(self, *args, **kwargs): django/trunk/tests/modeltests/basic/models.py
r6453 r7132 5 5 This is a basic model with only two non-primary-key fields. 6 6 """ 7 8 try: 9 set 10 except NameError: 11 from sets import Set as set 7 12 8 13 from django.db import models … … 390 395 >>> Article.objects.get(pk=a.id).headline 391 396 u'\u6797\u539f \u3081\u3050\u307f' 397 398 # Model instances have a hash function, so they can be used in sets or as 399 # dictionary keys. Two models compare as equal if their primary keys are equal. 400 >>> s = set([a10, a11, a12]) 401 >>> Article.objects.get(headline='Article 11') in s 402 True 392 403 """
