--- a/app/soc/views/models/survey.py Fri Jul 03 14:19:23 2009 +0200
+++ b/app/soc/views/models/survey.py Fri Jul 03 14:35:03 2009 +0200
@@ -55,6 +55,9 @@
TEXT_TYPES = set(('long_answer', 'short_answer'))
PROPERTY_TYPES = tuple(CHOICE_TYPES) + tuple(TEXT_TYPES)
+# used in View.getSchemaOptions to map POST values
+BOOL = {'True': True, 'False': False}
+
_short_answer = ("Short Answer",
"Less than 40 characters. Rendered as a text input. "
"It's possible to add a free form question (Content) "
@@ -424,6 +427,14 @@
if question_for in POST:
schema[key]["question"] = POST[question_for]
+ # set wheter the question is required
+ required_for = 'required_for_' + key
+ schema[key]['required'] = BOOL[POST[required_for]]
+
+ # set wheter the question allows comments
+ comment_for = 'comment_for_' + key
+ schema[key]['has_comment'] = BOOL[POST[comment_for]]
+
def createGet(self, request, context, params, seed):
"""Pass the question types for the survey creation template.
"""