def add_field_from_question(self, question, series, label=True):
     read_only = self.static
     rs = self.response_types.get(series)
     if rs and rs.editable == False:
         read_only=True
     field = register.get_input_plugin(question.widget).plugin
     if label:
         label="""<span class="identifier">%s.</span> 
                  <span class="question">%s</span>""" % (question.i18n.identifier,question.i18n.question)
     else:
         label = {
                 "Baseline":_("Baseline data"),
                 "2012 collection":_("Latest data"),
             }.get(series.name)
     if issubclass(field, forms.DateField):
         field = field(
                     help_text = question.i18n.help_text,
                     label = label,
                     required = False,
                     widget = field.widget(years=('2005','2006','2007','2008','2009','2010','2011','2012'))
         )
     else:
         field = field(
                     help_text = question.i18n.help_text,
                     label = label,
                     required = False,
         )
     if read_only:
         field.widget.attrs['readonly'] = 'readonly'
         field.widget.attrs['disabled'] = 'disabled'
         field.widget.attrs['class'] = 'hidden'
     self.fields['q_%s_%s' % (question.pk,series.pk)] = field
 def add_field_from_question(self, question):
     field = register.get_input_plugin(question.widget).plugin
     question_tuple = question.i18n
     self.fields['q_%s' % question.pk] = field(
                 label="""<span class="identifier">%s.</span> 
                         <span class="question">%s</span>""" % (question_tuple.identifier, question_tuple.question),
                 help_text=question_tuple.help_text,
                 required=False
     )