diff --git a/django/forms/fields.py b/django/forms/fields.py index 2420e2050a..836cd5d33c 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -28,7 +28,7 @@ from django.utils.translation import ugettext_lazy as _ 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__ = ( @@ -843,6 +843,7 @@ class FilePathField(ChoiceField): self.widget.choices = self.choices class SplitDateTimeField(MultiValueField): + widget = SplitDateTimeWidget hidden_widget = SplitHiddenDateTimeWidget default_error_messages = { 'invalid_date': _(u'Enter a valid date.'), diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index de8343c70a..f31ea6fa20 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -1322,6 +1322,8 @@ u'.../django/forms/fields.py' # SplitDateTimeField ########################################################## >>> f = SplitDateTimeField() +>>> f.widget +>> f.clean([datetime.date(2006, 1, 10), datetime.time(7, 30)]) datetime.datetime(2006, 1, 10, 7, 30) >>> f.clean(None)