#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 (models, ORM)  |    Version:  1.7
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 {{{
 model Page(models.Model):
     ...
     last_modified = models.Datefield(default=timezone.now)

     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>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.6b42f6c09a3b09f019a916d455ffd435%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to