Opened 10 years ago

Closed 10 years ago

#982 closed defect (fixed)

[patch] Comparing objects by negation should work

Reported by: GomoX <gomo@…> Owned by: adrian
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: UI/UX:


Ok, here's the deal.

Before my patch:

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

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/, 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@…> 10 years ago.
Patch for /trunk/django/core/meta/, adds ne() to the base model

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by GomoX <gomo@…>

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

comment:1 Changed 10 years ago by adrian

(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 Changed 10 years ago by adrian

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

comment:3 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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