#30224: Mysql Datetime value is string instead of datetime object
-------------------------------------+-------------------------------------
Reporter: Martin Kuhn | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Mysql | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* version: 2.2 => master
Comment:
Ah that's too bad. I guess we'll have to fix it on the Django side in this
case.
Does it only happen for `Min` and `Max` functions? If it's the case I'm
tempted to suggest we address the issue by implementing `as_mysql` methods
on these two functions that wrap the inner expression with a `CAST` like
you did here when `self.output_field.internal_type() == 'DateTimeField`.
The easiest way is probably to provide a different `template` to the super
functioné
Here's an example of how this was done for a duration handling of `Avg` on
MySQL
-
https://github.com/django/django/blob/846624ed0858aec0e51baebaa5b397e135c6d1dc/django/db/models/functions/mixins.py#L25-L29
-
https://github.com/django/django/blob/65858119d23e37872505a4476e7141c33981fb50/django/db/models/aggregates.py#L99
Happy to review your PR if you're interested in submitting one.
--
Ticket URL: <https://code.djangoproject.com/ticket/30224#comment:12>
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/065.0aef4198eff44ddcb6428436089f7edc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.