Fixed #6035 -- Gave the SplitDateTimeField the proper default widget. Thanks dtulig.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2008-11-10 19:42:55 +00:00
parent 6ed91234e3
commit 8cdc53a265
2 changed files with 4 additions and 1 deletions

View File

@ -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.'),

View File

@ -1322,6 +1322,8 @@ u'.../django/forms/fields.py'
# 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)