def render(self, request): if self.widget_type == "multiple_select": multiple = "multiple" else: multiple = None if self.widget_type == "option_select": onchange = "submit()" else: onchange = None tags = [ htmltag( "select", name=self.name, multiple=multiple, onchange=onchange, size=self.size, ) ] for object, description, key in self.options: if self.is_selected(object): selected = "selected" else: selected = None if description is None: description = "" r = htmltag("option", value=key, selected=selected) tags.append(r + htmlescape(description) + htmltext('</option>')) tags.append(htmltext("</select>")) return htmltext("\n").join(tags)
def render_content(self): tags = [htmltag("select", name=self.name, **self.attrs)] for object, description, key in self.options: if self.is_selected(object): selected = 'selected' else: selected = None if description is None: description = "" r = htmltag("option", value=key, selected=selected) tags.append(r + htmlescape(description) + htmltext('</option>')) tags.append(htmltext("</select>")) return htmltext("\n").join(tags)
def render(self, request): return htmltag("input", xml_end=1, type="checkbox", name=self.name, value="yes", checked=self.value and "checked" or None)
def render_content(self): return htmltag("input", xml_end=True, type=self.HTML_TYPE, name=self.name, value=self.value, **self.attrs)
def _render_start(self): r = TemplateIO(html=True) r += htmltag('form', method=self.method, enctype=self.enctype, action=self.action, **self.attrs) r += self._render_hidden_widgets() return r.getvalue()
def render_content(self): return htmltag("input", xml_end=True, type="checkbox", name=self.name, value="yes", checked=self.value and "checked" or None, **self.attrs)
def render(self, request): value = (self.value and htmlescape(self.value) or None) return htmltag("input", xml_end=1, type="submit", name=self.name, value=value)
def _render_start(self, request, action, enctype=None, method='post', name=None): r = TemplateIO(html=1) r += htmltag('form', enctype=enctype, method=method, action=action, name=name) r += self._render_hidden_widgets(request) return r.getvalue()
def _render_start(self): r = TemplateIO(html=True) r += htmltag('form', name=self.name, method=self.method, enctype=self.enctype, action=self.action_url, **self.attrs) r += self._render_hidden_widgets() return r.getvalue()
def render(self, request, **attributes): return htmltag("input", xml_end=1, type=self.html_type, name=self.name, size=self.size, maxlength=self.maxlength, value=self.value, **attributes)
def render(self, request): return (htmltag("textarea", name=self.name, cols=self.cols, rows=self.rows, wrap=self.wrap, css_class=self.css_class) + htmlescape(self.value or "") + htmltext("</textarea>"))
def render_content(self): # slightly different behavior here, we always render the # tag using the 'value' passed in as a parameter. 'self.value' # is a boolean that is true if the button's name appears # in the request. value = (self.label and htmlescape(self.label) or None) return htmltag("input", xml_end=True, type=self.HTML_TYPE, name=self.name, value=value, **self.attrs)
def render(self, request): if self.value is None: value = None else: value = htmlescape(self.value) return htmltag( "input", xml_end=1, type="hidden", name=self.name, value=value )
def render(self, request): if self.value is None: value = None else: value = htmlescape(self.value) return htmltag("input", xml_end=1, type="hidden", name=self.name, value=value)
def render_content(self): if self.value is None: value = None else: value = htmlescape(self.value) return htmltag("input", xml_end=True, type="hidden", name=self.name, value=value, **self.attrs)
def render(self, request): tags = [] for object, description, key in self.options: if self.is_selected(object): checked = ValuelessAttr else: checked = None r = htmltag("input", xml_end=True, type="radio", name=self.name, value=key, checked=checked) tags.append(r + htmlescape(description)) return htmlescape(self.delim).join(tags)
def render(self, request): if self.widget_type == "multiple_select": multiple = ValuelessAttr else: multiple = None if self.widget_type == "option_select": onchange = "submit()" else: onchange = None tags = [htmltag("select", name=self.name, multiple=multiple, onchange=onchange, size=self.size)] for object, description, key in self.options: if self.is_selected(object): selected = ValuelessAttr else: selected = None if description is None: description = "" r = htmltag("option", value=key, selected=selected) tags.append(r + htmlescape(description) + htmltext('</option>')) tags.append(htmltext("</select>")) return htmltext("\n").join(tags)
def render(self, request): tags = [] for object, description, key in self.options: if self.is_selected(object): checked = "checked" else: checked = None r = htmltag("input", xml_end=True, type="radio", name=self.name, value=key, checked=checked) tags.append(r + htmlescape(description)) return htmlescape(self.delim).join(tags)
def render_content(self): tags = [] for object, description, key in self.options: if self.is_selected(object): checked = 'checked' else: checked = None r = htmltag("input", xml_end=True, type="radio", name=self.name, value=key, checked=checked, **self.attrs) tags.append(r + htmlescape(description)) return htmlescape(self.delim).join(tags)
def render_content(self): tags = [] for object, description, key in self.options: if self.is_selected(object): checked = 'checked' else: checked = None r = htmltag( "input", xml_end=True, type="radio", name=self.name, value=key, checked=checked, **self.attrs, ) tags.append(r + htmlescape(description)) return htmlescape(self.delim).join(tags)
def render_content(self): return (htmltag("textarea", name=self.name, **self.attrs) + htmlescape(self.value or "") + htmltext("</textarea>"))
def render(self, request): return htmltag("input", xml_end=1, type="checkbox", name=self.name, value="yes", checked=self.value and ValuelessAttr or None)