Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored December 05, 2005

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  django/core/meta/__init__.py
4  django/core/meta/__init__.py
@@ -729,6 +729,7 @@ def __new__(cls, name, bases, attrs):
729 729
         # Create the default class methods.
730 730
         attrs['__init__'] = curry(method_init, opts)
731 731
         attrs['__eq__'] = curry(method_eq, opts)
  732
+        attrs['__ne__'] = curry(method_ne, opts)
732 733
         attrs['save'] = curry(method_save, opts)
733 734
         attrs['save'].alters_data = True
734 735
         attrs['delete'] = curry(method_delete, opts)
@@ -978,6 +979,9 @@ def method_init(opts, self, *args, **kwargs):
978 979
 def method_eq(opts, self, other):
979 980
     return isinstance(other, self.__class__) and getattr(self, opts.pk.attname) == getattr(other, opts.pk.attname)
980 981
 
  982
+def method_ne(opts, self, other):
  983
+    return not method_eq(opts, self, other)
  984
+
981 985
 def method_save(opts, self):
982 986
     # Run any pre-save hooks.
983 987
     if hasattr(self, '_pre_save'):

0 notes on commit 3cd7755

Please sign in to comment.
Something went wrong with that request. Please try again.