Ejemplo n.º 1
0
 def render(self, options, **kwargs):
     self.radios = []
     for i, (choice_name, choice_value) in enumerate(_extract_options(options)):
         choice_id = '%s_%i' % (self.name, i)
         radio = self.widget(self.name, choice_value, id=choice_id,
                             checked=self._is_checked(choice_value), **kwargs)
         label = h.content_tag('label', choice_name, for_=choice_id)
         self.radios.append(self.format % dict(field=radio,
                                               label=label))
     return h.tag("br").join(self.radios)
Ejemplo n.º 2
0
 def render_readonly(self, **kwargs):
     """render the image tag with a link to the image itself.
     """
     value = self.field.value
     if value:
         url = self.get_url(value)
         content = "%s (%s)" % (normalized_basename(value), self.readable_size())
         tag = h.tag("img", src=url, alt=content)
         return h.content_tag("a", tag, href=url, **kwargs)
     return ""
Ejemplo n.º 3
0
 def render_readonly(self, **kwargs):
     """render the image tag with a link to the image itself.
     """
     value = self.field.value
     if value:
         url = self.get_url(value)
         content = '%s (%s)' % (normalized_basename(value),
                              self.readable_size())
         tag = h.tag('img', src=url, alt=content)
         return h.content_tag('a', tag, href=url, **kwargs)
     return ''
Ejemplo n.º 4
0
 def _render(self, default=None, **kwargs):
     value = default or self.value
     self.radios = []
     for i, (choice_name, choice_value) in enumerate( [('Ja','True'),('Nein','False')]):
         choice_id = '%s_%i' % (self.name, i)
         radio = self.widget(self.name, choice_value, id=choice_id,
                             checked=self._is_checked(choice_value, value),
                             **kwargs)
         label = h.label(choice_name, for_=choice_id)
         self.radios.append(h.literal(self.format % dict(field=radio,
                                                         label=label)))
     return h.tag("br").join(self.radios)
Ejemplo n.º 5
0
 def render_readonly(self, **kwargs):
     return helpers.content_tag("span", ("," + helpers.tag("br")).join([
         helpers.literal(value) for value in self.raw_value
     ]), style="white-space: nowrap;")
Ejemplo n.º 6
0
 def render_readonly(self, **kwargs):
     return helpers.content_tag("span", ("," + helpers.tag("br")).join(
         [helpers.literal(value) for value in self.raw_value]),
                                style="white-space: nowrap;")