#24486: UnboundLocalError in db.models.expressions
----------------------------------------------+--------------------
     Reporter:  yoyoma                        |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  master
     Severity:  Release blocker               |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 After filing #24485, I stumbled into a bug that is somewhat related, in
 the sense of its relationship to {{{output_field}}} and
 {{{DurationField}}} support in general. An {{{UnboundLocalError}}} occurs
 @
 
https://github.com/django/django/blob/ceaf31adfff3801f1092a215f73704e15a70e90c/django/db/models/expressions.py#L401.

 I discovered this while running the following:

 {{{
 Ticket.objects.filter(
     active_at__lte=now,
     active_at__gt=now - models.F('duration')
 )
 }}}

 Using the following model:

 {{{
 class Ticket(models.Model):
     # ... other fields omitted
     active_at = models.DateTimeField()
     duration = models.DurationField()
 }}}

 I've categorized this as a release blocker, because it prohibits the use
 of {{{DurationField}}} with {{{F}}}.

--
Ticket URL: <https://code.djangoproject.com/ticket/24486>
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/049.bfc2bbac8e735e2a7b5b8ba00083c521%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to