Opened 18 years ago

Closed 18 years ago

#982 closed defect (fixed)

[patch] Comparing objects by negation should work

Reported by: GomoX <gomo@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: major Keywords:
Cc: gomo@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Ok, here's the deal.

Before my patch:

>>> cuota.get_prestamo() != depositos.get_object(pk=2).get_prestamo()
True
>>> cuota.get_prestamo() == depositos.get_object(pk=2).get_prestamo()
True

That's not the expected behaviour, of course. The problem was that the base model wasn't being added the __ne__ method. I added this method and then added it to the base model. This trivial patch is to be applied on /trunk/django/core/meta/__init__.py, but I am working on an old version so the line numbers might not match, since there have been recent revisions to it. Adding the 3 lines manually shouldn't be a problem :)

Attachments (1)

__init__.diff (825 bytes ) - added by GomoX <gomo@…> 18 years ago.
Patch for /trunk/django/core/meta/init.py, adds ne() to the base model

Download all attachments as: .zip

Change History (4)

by GomoX <gomo@…>, 18 years ago

Attachment: __init__.diff added

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

comment:1 by Adrian Holovaty, 18 years ago

(In [1545]) Added unit tests for #982, but they're passing for me on Python 2.4. Maybe the problem is Python 2.3? Refs #982

comment:2 by Adrian Holovaty, 18 years ago

(In [1546]) Added two more unit tests for #982 (which still pass under Python 2.4). Refs #982

comment:3 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [1547]) Fixed #982 -- Added 'ne' support for Django models, which apparently wasn't working on Python 2.3 (?)

Note: See TracTickets for help on using tickets.
Back to Top