Django

Code

Ticket #982 (closed: fixed)

Opened 3 years ago

Last modified 3 years ago

[patch] Comparing objects by negation should work

Reported by: GomoX <gomo@datafull.com> Assigned to: adrian
Milestone: Component: Database layer (models, ORM)
Version: Keywords:
Cc: gomo@datafull.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

__init__.diff (0.8 kB) - added by GomoX <gomo@datafull.com> on 12/02/05 11:51:15.
Patch for /trunk/django/core/meta/init.py, adds ne() to the base model

Change History

12/02/05 11:51:15 changed by GomoX <gomo@datafull.com>

  • attachment __init__.diff added.

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

12/04/05 21:34:36 changed 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

12/04/05 21:37:24 changed by adrian

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

12/04/05 21:39:19 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #982 ([patch] Comparing objects by negation should work)




Change Properties
Action