summaryrefslogtreecommitdiffstats
path: root/forms.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2013-09-04 15:49:03 +0000
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2013-09-04 15:52:20 +0000
commitd29ad289dc6b4873c1ab06841509aeb21fa28958 (patch)
tree4fcf292afab3537142976dfa0a7f9af4a6464bb8 /forms.py
parent1a9edf1fcb945f7f235ad5691f4958d1c4089dc0 (diff)
downloadpadlite-teams-d29ad289dc6b4873c1ab06841509aeb21fa28958.tar.gz
padlite-teams-d29ad289dc6b4873c1ab06841509aeb21fa28958.tar.bz2
padlite-teams-d29ad289dc6b4873c1ab06841509aeb21fa28958.zip
add ability to create new groups
Diffstat (limited to 'forms.py')
-rw-r--r--forms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/forms.py b/forms.py
new file mode 100644
index 0000000..7333acf
--- /dev/null
+++ b/forms.py
@@ -0,0 +1,11 @@
+from wtforms import Form, TextField, validators
+from utils import Unique
+from models import Group
+
+class CreateGroup(Form):
+ name = TextField('group name', [
+ validators.Required(),
+ validators.Regexp('^[a-zA-Z-1-9_-]+$',
+ message=u'Invalid group name (only simple characters, numbers, - and _).'),
+ Unique(Group, Group.name,
+ message=u'A group with this name already exists.')])