Opened 10 years ago
Closed 10 years ago
#24004 closed Bug (invalid)
Can't use only() with latest() if x is in only() and get_latest_by
Reported by: | Tom Carrick | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
model Page(models.Model): ... last_modified = models.DateField() class Meta: get_latest_by = 'last_modified'
Suppose I want to get the date of the last modification, I might do something like this:
Page.objects.only('last_modified').latest()
But on trying it, we seem to get stuck copying something until we reach maximum recursion depth.
I don't know if this is a bug or if it's simply not going to work, but if it's the latter, I think it could be documented somewhere.
Attachments (1)
Change History (6)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
comment:2 by , 10 years ago
Description: | modified (diff) |
---|
comment:3 by , 10 years ago
by , 10 years ago
Attachment: | testcase_repro_24004.diff added |
---|
comment:4 by , 10 years ago
My apologies. After some experimentation, I've determined this only fails when using django-mptt, so I'm going to take the bug to them. Please close this.
comment:5 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
No worries, thanks for following up.
(For the record, you don't need special permissions to close a ticket)
Hi,
I can't seem to be able to reproduce the issue you're describing (I've attached the test case I used as a patch).
Could you also show the traceback you're getting as well as the full composition of your models (or ideally a reduced version of it that still shows the issue).
Thanks!