From cacd0f45bf1fbc5bd62c04ed974555bf6ada12e3 Mon Sep 17 00:00:00 2001 From: Moritz Schlarb Date: Tue, 27 Aug 2013 23:17:00 +0200 Subject: [PATCH] Demos. --- tw2/forms/__init__.py | 6 ++++++ tw2/forms/samples.py | 24 +++++++++++++++++++++++- tw2/forms/widgets.py | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tw2/forms/__init__.py b/tw2/forms/__init__.py index 342038f..a31ce99 100644 --- a/tw2/forms/__init__.py +++ b/tw2/forms/__init__.py @@ -7,6 +7,8 @@ CheckBox, CheckBoxList, CheckBoxTable, + ColorField, + EmailField, FieldSet, FileField, FileValidator, @@ -25,12 +27,15 @@ ListLayout, MultipleSelectField, MultipleSelectionField, + NumberField, PasswordField, RadioButton, RadioButtonList, RadioButtonTable, + RangeField, ResetButton, RowLayout, + SearchField, SelectionField, SeparatedCheckBoxTable, SeparatedRadioButtonTable, @@ -43,6 +48,7 @@ TableLayout, TextField, TextArea, + UrlField, VerticalCheckBoxTable, VerticalRadioButtonTable, ) diff --git a/tw2/forms/samples.py b/tw2/forms/samples.py index 6fd8c75..35eb940 100644 --- a/tw2/forms/samples.py +++ b/tw2/forms/samples.py @@ -12,7 +12,7 @@ class DemoTextField(twf.TextField): - placeholder = "Search upto 7 characters..." + placeholder = "Type up to 7 characters..." maxlength = 7 @@ -121,3 +121,25 @@ def address(self): ] fields = [DummyObject.name, DummyObject.address] + + +class DemoEmailField(twf.EmailField): + placeholder = 'Enter your Email-Address...' + + +class DemoUrlField(twf.UrlField): + placeholder = 'http://toscawidgets.org' + + +class DemoNumberField(twf.NumberField): + min = 0 + max = 10 + step = 2 + value = 8 + + +class DemoRangeField(twf.RangeField): + min = 0 + max = 10 + step = 2 + value = 8 diff --git a/tw2/forms/widgets.py b/tw2/forms/widgets.py index 2fd2762..8ec7ee6 100755 --- a/tw2/forms/widgets.py +++ b/tw2/forms/widgets.py @@ -310,7 +310,7 @@ class EmailField(TextField): validator = twc.EmailValidator -class URLField(TextField): +class UrlField(TextField): '''An url input field (HTML5 only). Will fallback to a normal text input field on browser not supporting HTML5.