Ticket #982: __init__.diff

File __init__.diff, 825 bytes (added by GomoX <gomo@…>, 19 years ago)

Patch for /trunk/django/core/meta/init.py, adds ne() to the base model

  • __init__.py

    old new  
    592592        # Create the default class methods.
    593593        attrs['__init__'] = curry(method_init, opts)
    594594        attrs['__eq__'] = curry(method_eq, opts)
     595        attrs['__ne__'] = curry(method_ne, opts)
    595596        attrs['save'] = curry(method_save, opts)
    596597        attrs['save'].alters_data = True
    597598        attrs['delete'] = curry(method_delete, opts)
     
    845846def method_eq(opts, self, other):
    846847    return isinstance(other, self.__class__) and getattr(self, opts.pk.column) == getattr(other, opts.pk.column)
    847848
     849def method_ne(opts, self, other):
     850    return not method_eq(opts, self, other)
    848851def method_save(opts, self):
    849852    # Run any pre-save hooks.
    850853    if hasattr(self, '_pre_save'):
Back to Top