From 86870e758709bd5c9e9fb357d641f0cefd983db0 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sun, 24 Dec 2006 20:22:38 +0000 Subject: [PATCH] newforms: Added django.newforms.extras.widgets, with SelectDateWidget implementation, plus some unit tests git-svn-id: http://code.djangoproject.com/svn/django/trunk@4236 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/extras/__init__.py | 1 + django/newforms/extras/widgets.py | 59 ++++++++++++ tests/regressiontests/forms/tests.py | 135 +++++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 django/newforms/extras/__init__.py create mode 100644 django/newforms/extras/widgets.py diff --git a/django/newforms/extras/__init__.py b/django/newforms/extras/__init__.py new file mode 100644 index 0000000000..a7f6a9b3f6 --- /dev/null +++ b/django/newforms/extras/__init__.py @@ -0,0 +1 @@ +from widgets import * diff --git a/django/newforms/extras/widgets.py b/django/newforms/extras/widgets.py new file mode 100644 index 0000000000..1011934fb8 --- /dev/null +++ b/django/newforms/extras/widgets.py @@ -0,0 +1,59 @@ +""" +Extra HTML Widget classes +""" + +from django.newforms.widgets import Widget, Select +from django.utils.dates import MONTHS +import datetime + +__all__ = ('SelectDateWidget',) + +class SelectDateWidget(Widget): + """ + A Widget that splits date input into three

+ +################# +# Extra widgets # +################# + +The newforms library comes with some extra, higher-level Widget classes that +demonstrate some of the library's abilities. + +# SelectDateWidget ############################################################ + +>>> from django.newforms.extras import SelectDateWidget +>>> w = SelectDateWidget() +>>> print w.render('mydate', '') + + + +>>> w.render('mydate', None) == w.render('mydate', '') +True +>>> print w.render('mydate', '2010-04-15') + + + + """ if __name__ == "__main__":