#23420: Custom lookup transformers can't create DateTimeFields when USE_TZ=True
-------------------------------------+-------------------------------------
Reporter: chosak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.7
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: lookup, transform, | Needs documentation: 0
datetimefield | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):
* needs_better_patch: => 1
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
The issue is valid and patches look very good.
I would like to avoid the `\` in patch 2 and make the code more robust
with this pattern:
{{{
try:
name = '%s.%s' % (self.model.__name__, self.name)
except AttributeError:
name = '(unbound)'
}}}
In patch 3, I would also suggest to:
- rename `UnixTimestamp` to `MySQLUnixTimestamp` to make it clear that
it's database-specific;
- avoid overriding `save()`; creating an instance with
`UnixTimestamp.objects.create(ts=time.time())` in the tests will be easier
to understand for future readers.
Would you like to submit a pull request on GitHub? (Add yourself in
AUTHORS if you aren't there already.)
Otherwise I can take care of committing the changes.
--
Ticket URL: <https://code.djangoproject.com/ticket/23420#comment:1>
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/064.950f7a1e6d9fe80757cd4946de96b150%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.