Opened 18 years ago
Closed 17 years ago
#3113 closed enhancement (wontfix)
[patch] newforms support for parsedatetime with DateField
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | |
Severity: | normal | Keywords: | |
Cc: | sam@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
What about these for "cleaning" Date-based fields? Or maybe for a "HumanDateTimeField()"? They would allow people to enter in hazy, non specific dates and times, like "tomorrow", "next tuesday", or "10/24/2006".
http://cheeseshop.python.org/pypi/ParseTime/1.0
http://cheeseshop.python.org/pypi/parsedatetime/0.8.0
The second seems more robust, but the first seems more lightweight.
Attachments (1)
Change History (14)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Oh, I hadn't realized. Of course that would be good. I'm not sure that it should be done at the Javascript level, though.
comment:3 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
As those two date-parsing libraries are third-party modules (and released under different licenses than ours), I don't think we should use them by the default DateField. If you reopen this with a full patch, we could add it to django.newforms.extras as an optional add-on for folks who have it installed. (If you decide to do that, I'd encourage you to use parsedatetime rather than ParseTime, because the former appears to be more portable across different OSes.)
comment:5 by , 18 years ago
Well, since this is no django.newforms.extras yet, there is no diff available. So I attached extras.py.
comment:6 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:7 by , 18 years ago
Summary: | What about "humanizing" the date entry field? → [patch] newforms support for parsedatetime with DateField |
---|
comment:8 by , 18 years ago
#8 is similar. We can close that ticket once we've integrated newforms into the Django admin site and with Django models.
comment:9 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:10 by , 18 years ago
From this comment in #8:
What about using dateutil's parse method? Seems to work really well:
>>> from dateutil.parser import parse >>> parse("Tuesday") datetime.datetime(2006, 12, 26, 0, 0)
for example...
See: http://labix.org/python-dateutil#head-c0e81a473b647dfa787dc11e8c69557ec2c3ecd2
comment:11 by , 18 years ago
Needs documentation: | set |
---|
Assuming that the 3rd party library will have it's own testing.
comment:12 by , 17 years ago
Cc: | added |
---|
comment:13 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Since it's now pretty easy to write custom fields (http://www.djangoproject.com/documentation/custom_model_fields/), this is now something anyone can just do in their own apps.
AFAIK this is possible right now because we bundle Simon's magic date-parsing JavaScript. Is that not working for you?