app/soc/views/helper/surveys.py
changeset 2526 8f29bfb9eb52
parent 2520 859ada69db69
child 2527 ce657149b90a
equal deleted inserted replaced
2525:7df431ddcfd3 2526:8f29bfb9eb52
    54   <select id="required_for_{{ name }}" name="required_for_{{ name }}">
    54   <select id="required_for_{{ name }}" name="required_for_{{ name }}">
    55     <option value="True" {% if is_required %} selected='selected' {% endif %}
    55     <option value="True" {% if is_required %} selected='selected' {% endif %}
    56      >True</option>
    56      >True</option>
    57     <option value="False" {% if not is_required %} selected='selected'
    57     <option value="False" {% if not is_required %} selected='selected'
    58      {% endif %}>False</option>
    58      {% endif %}>False</option>
    59   </select><br/>
    59   </select>
    60 
    60 
    61   <label for="comment_for_{{ name }}">Allow Comments</label>
    61   <label for="comment_for_{{ name }}">Allow Comments</label>
    62   <select id="comment_for_{{ name }}" name="comment_for_{{ name }}">
    62   <select id="comment_for_{{ name }}" name="comment_for_{{ name }}">
    63     <option value="True" {% if has_comment %} selected='selected' {% endif %}
    63     <option value="True" {% if has_comment %} selected='selected' {% endif %}
    64      >True</option>
    64      >True</option>
    65     <option value="False" {% if not has_comment %} selected='selected'
    65     <option value="False" {% if not has_comment %} selected='selected'
    66      {% endif %}>False</option>
    66      {% endif %}>False</option>
    67   </select><br/>
    67   </select>
    68 """
    68 """
    69 
    69 
    70 
    70 
    71 class SurveyTakeForm(djangoforms.ModelForm):
    71 class SurveyTakeForm(djangoforms.ModelForm):
    72   """SurveyContent form for recording survey answers.
    72   """SurveyContent form for recording survey answers.
   377       field: the name of the field to add the comment field to
   377       field: the name of the field to add the comment field to
   378       comment: the initial value of this field.
   378       comment: the initial value of this field.
   379       attrs: the attrs for the widget
   379       attrs: the attrs for the widget
   380       tip: tooltip text for this field
   380       tip: tooltip text for this field
   381     """
   381     """
       
   382     attrs['class'] = 'comment'
   382     widget = widgets.Textarea(attrs=attrs)
   383     widget = widgets.Textarea(attrs=attrs)
   383     comment_field = CharField(help_text=tip, required=False, label='Comments',
   384     comment_field = CharField(help_text=tip, required=False, 
   384                               widget=widget, initial=comment)
   385         label='Add a Comment (optional)', widget=widget, initial=comment)
   385     self.survey_fields[COMMENT_PREFIX + field] = comment_field
   386     self.survey_fields[COMMENT_PREFIX + field] = comment_field
   386 
   387 
   387 
   388 
   388   class Meta(object):
   389   class Meta(object):
   389     model = SurveyContent
   390     model = SurveyContent