Skip to content

Commit

Permalink
Fixed #6035 -- Gave the SplitDateTimeField the proper default widget.…
Browse files Browse the repository at this point in the history
… Thanks dtulig.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
kmtracey committed Nov 10, 2008
1 parent 6ed9123 commit 8cdc53a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from django.utils.encoding import smart_unicode, smart_str

from util import ErrorList, ValidationError
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput, TimeInput, SplitHiddenDateTimeWidget
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput, TimeInput, SplitDateTimeWidget, SplitHiddenDateTimeWidget
from django.core.files.uploadedfile import SimpleUploadedFile as UploadedFile

__all__ = (
Expand Down Expand Up @@ -843,6 +843,7 @@ def __init__(self, path, match=None, recursive=False, required=True,
self.widget.choices = self.choices

class SplitDateTimeField(MultiValueField):
widget = SplitDateTimeWidget
hidden_widget = SplitHiddenDateTimeWidget
default_error_messages = {
'invalid_date': _(u'Enter a valid date.'),
Expand Down
2 changes: 2 additions & 0 deletions tests/regressiontests/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@
# SplitDateTimeField ##########################################################
>>> f = SplitDateTimeField()
>>> f.widget
<django.forms.widgets.SplitDateTimeWidget object ...
>>> f.clean([datetime.date(2006, 1, 10), datetime.time(7, 30)])
datetime.datetime(2006, 1, 10, 7, 30)
>>> f.clean(None)
Expand Down

0 comments on commit 8cdc53a

Please sign in to comment.