#24004: Can't use only() with latest() if x is in only() and get_latest_by
-------------------------------------+-------------------------------------
     Reporter:  knyghty              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.7
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by knyghty:

Old description:

> {{{
> 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.

New description:

 {{{
 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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24004#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.1aac1f7f0919f18393c1c6877a58f0bc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to