Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #982 -- Added '__ne__' support for Django models, which apparen…

…tly wasn't working on Python 2.3 (?)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3cd7755ec6b421c8ac4ef8903be9781ba015b3ab 1 parent 65c1a9f
Adrian Holovaty adrianholovaty authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/core/meta/__init__.py
4 django/core/meta/__init__.py
View
@@ -729,6 +729,7 @@ def __new__(cls, name, bases, attrs):
# Create the default class methods.
attrs['__init__'] = curry(method_init, opts)
attrs['__eq__'] = curry(method_eq, opts)
+ attrs['__ne__'] = curry(method_ne, opts)
attrs['save'] = curry(method_save, opts)
attrs['save'].alters_data = True
attrs['delete'] = curry(method_delete, opts)
@@ -978,6 +979,9 @@ def method_init(opts, self, *args, **kwargs):
def method_eq(opts, self, other):
return isinstance(other, self.__class__) and getattr(self, opts.pk.attname) == getattr(other, opts.pk.attname)
+def method_ne(opts, self, other):
+ return not method_eq(opts, self, other)
+
def method_save(opts, self):
# Run any pre-save hooks.
if hasattr(self, '_pre_save'):
Please sign in to comment.
Something went wrong with that request. Please try again.