Skip to content

Proper SplitDateTimeWidget overriding through overload #4

@mutaku

Description

@mutaku

Right now we must alter the widgets source to allow datetime splitting. However, we should do this in a safer and more distributable way by overloading this widget.

diff /usr/local/lib/python2.7/site-packages/django/forms/widgets.py /usr/local/lib/python2.7/site-packages/django/forms/widgets.py.orig
904,909c904,905
<             #value = to_current_timezone(value)
<             if isinstance(value, six.string_types):
<       return value.split(',')
<       else:
<       value = to_current_timezone(value)
<       return [value.date(), value.time().replace(microsecond=0)]

---
>             value = to_current_timezone(value)
>             return [value.date(), value.time().replace(microsecond=0)]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions