Skip to content

Commit 3cd7755

Browse files
Fixed #982 -- Added '__ne__' support for Django models, which apparently wasn't working on Python 2.3 (?)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 65c1a9f commit 3cd7755

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

django/core/meta/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ def __new__(cls, name, bases, attrs):
729729
# Create the default class methods.
730730
attrs['__init__'] = curry(method_init, opts)
731731
attrs['__eq__'] = curry(method_eq, opts)
732+
attrs['__ne__'] = curry(method_ne, opts)
732733
attrs['save'] = curry(method_save, opts)
733734
attrs['save'].alters_data = True
734735
attrs['delete'] = curry(method_delete, opts)
@@ -978,6 +979,9 @@ def method_init(opts, self, *args, **kwargs):
978979
def method_eq(opts, self, other):
979980
return isinstance(other, self.__class__) and getattr(self, opts.pk.attname) == getattr(other, opts.pk.attname)
980981

982+
def method_ne(opts, self, other):
983+
return not method_eq(opts, self, other)
984+
981985
def method_save(opts, self):
982986
# Run any pre-save hooks.
983987
if hasattr(self, '_pre_save'):

0 commit comments

Comments
 (0)