web/formfields.py
changeset 2726 03e7a6efd960
parent 2680 66472d85d548
parent 2724 7966d87202d7
child 3246 9e4adca73a95
equal deleted inserted replaced
2722:e39982748753 2726:03e7a6efd960
   255         # context dictionnary
   255         # context dictionnary
   256         req = form.req
   256         req = form.req
   257         try:
   257         try:
   258             return req.data[self]
   258             return req.data[self]
   259         except KeyError:
   259         except KeyError:
   260             fkwargs = {}
   260             fkwargs = {'eidparam': self.eidparam}
   261             if self.use_fckeditor(form):
   261             if self.use_fckeditor(form):
   262                 # if fckeditor is used and format field isn't explicitly
   262                 # if fckeditor is used and format field isn't explicitly
   263                 # deactivated, we want an hidden field for the format
   263                 # deactivated, we want an hidden field for the format
   264                 fkwargs['widget'] = HiddenInput()
   264                 fkwargs['widget'] = HiddenInput()
   265                 fkwargs['initial'] = 'text/html'
   265                 fkwargs['initial'] = 'text/html'
   290 
   290 
   291     def render(self, form, renderer):
   291     def render(self, form, renderer):
   292         format_field = self.get_format_field(form)
   292         format_field = self.get_format_field(form)
   293         if format_field:
   293         if format_field:
   294             # XXX we want both fields to remain vertically aligned
   294             # XXX we want both fields to remain vertically aligned
   295             format_field.widget.attrs['style'] = 'display: block'
   295             if format_field.is_visible():
       
   296                 format_field.widget.attrs['style'] = 'display: block'
   296             result = format_field.render(form, renderer)
   297             result = format_field.render(form, renderer)
   297         else:
   298         else:
   298             result = u''
   299             result = u''
   299         return result + self.get_widget(form).render(form, self, renderer)
   300         return result + self.get_widget(form).render(form, self, renderer)
   300 
   301