Opened 20 years ago
Closed 20 years ago
#982 closed defect (fixed)
[patch] Comparing objects by negation should work
| Reported by: | 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)
Change History (4)
by , 20 years ago
| Attachment: | __init__.diff added |
|---|
comment:1 by , 20 years ago
comment:2 by , 20 years ago
comment:3 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Patch for /trunk/django/core/meta/init.py, adds ne() to the base model