#31755: make temporal subtraction work without ExpressionWrapper
-------------------------------------+-------------------------------------
               Reporter:  Sergey     |          Owner:  nobody
  Fedoseev                           |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  master
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 {{{
 class Experiment(models.Model):
     start = models.DateTimeField()
     end = models.DateTimeField()

 Experiment.objects.annotate(
     delta=F('end') - F('start') + Value(datetime.timedelta(),
 output_field=DurationField())
 )
 }}}
 This gives:
 {{{
 django.core.exceptions.FieldError: Expression contains mixed types:
 DateTimeField, DurationField. You must set output_field.
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31755>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.b98a1e9883390e717f8f1f3594611dd6%40djangoproject.com.

Reply via email to