Opened 9 years ago

Closed 8 years ago

#3113 closed enhancement (wontfix)

[patch] newforms support for parsedatetime with DateField

Reported by: Brantley <deadwisdom@…> 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: UI/UX:

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)

extras.py (1.7 KB) - added by Brantley <deadwisdom@…> 9 years ago.
HumanDateTimeField

Download all attachments as: .zip

Change History (14)

comment:1 Changed 9 years ago by ubernostrum

AFAIK this is possible right now because we bundle Simon's magic date-parsing JavaScript. Is that not working for you?

comment:2 Changed 9 years ago by Brantley

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 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to 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:4 Changed 9 years ago by Brantley <deadwisdom@…>

Will do.

comment:5 Changed 9 years ago by Brantley <deadwisdom@…>

Well, since this is no django.newforms.extras yet, there is no diff available. So I attached extras.py.

Changed 9 years ago by Brantley <deadwisdom@…>

HumanDateTimeField

comment:6 Changed 9 years ago by Brantley <deadwisdom@…>

  • Resolution wontfix deleted
  • Status changed from closed to reopened

comment:7 Changed 9 years ago by adrian

  • Summary changed from What about "humanizing" the date entry field? to [patch] newforms support for parsedatetime with DateField

comment:8 Changed 9 years ago by adrian

#8 is similar. We can close that ticket once we've integrated newforms into the Django admin site and with Django models.

comment:9 Changed 8 years ago by adrian

  • Triage Stage changed from Unreviewed to Design decision needed

comment:10 Changed 8 years ago by Gary Wilson <gary.wilson@…>

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 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Needs documentation set

Assuming that the 3rd party library will have it's own testing.

comment:12 Changed 8 years ago by anonymous

  • Cc sam@… added

comment:13 Changed 8 years ago by jacob

  • Resolution set to wontfix
  • Status changed from reopened to 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.

Note: See TracTickets for help on using tickets.
Back to Top