#33397: Arithmetic operations on DateField/DateTimeField/DurationField
expressions
are buggy.
-------------------------------------+-------------------------------------
Reporter: Luke Plant | Owner: Luke
| Plant
Type: Bug | Status: closed
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"40b8a6174f001a310aa33f7880db0efeeb04d4c4" 40b8a617]:
{{{
#!CommitTicketReference repository=""
revision="40b8a6174f001a310aa33f7880db0efeeb04d4c4"
Fixed #33397 -- Corrected resolving output_field for
DateField/DateTimeField/TimeField/DurationFields.
This includes refactoring of CombinedExpression._resolve_output_field()
so it no longer uses the behavior inherited from Expression of guessing
same output type if argument types match, and instead we explicitly
define the output type of all supported operations.
This also makes nonsensical operations involving dates
(e.g. date + date) raise a FieldError, and adds support for
automatically inferring output_field for cases such as:
* date - date
* date + duration
* date - duration
* time + duration
* time - time
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33397#comment:11>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017fdf63da28-f207c2f1-d9b2-45cf-bf50-ed33fed817ff-000000%40eu-central-1.amazonses.com.