• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.flatatt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.flatatt函数的典型用法代码示例。如果您正苦于以下问题:Python flatatt函数的具体用法?Python flatatt怎么用?Python flatatt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了flatatt函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: render

 def render(self, name, value, attrs=None):
     if value is None:
         value = ""
     final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
     if value != "":
         final_attrs["value"] = smart_unicode(value)  # Only add the 'value' attribute if a value is non-empty.
     return u"<input%s />" % flatatt(final_attrs)
开发者ID:JWW81,项目名称:stochss,代码行数:7,代码来源:widgets.py


示例2: render

    def render(self, name, value, attrs=None):
        if value is None:
            value = ''
        final_attrs = self.build_attrs(attrs, name=name)

        return mark_safe(u'<textarea%s>%s</textarea>' % (flatatt(final_attrs),
                conditional_escape(force_unicode(value))))
开发者ID:3smobile,项目名称:django-html5-forms,代码行数:7,代码来源:widgets.py


示例3: render

 def render(self, name, value, attrs=None):
     if value is None: value = ''
     final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
     if value != '':
         # Only add the 'value' attribute if a value is non-empty.
         final_attrs['value'] = force_unicode(value)
     return mark_safe(u'<input%s />' % flatatt(final_attrs))
开发者ID:FashtimeDotCom,项目名称:MoleSys,代码行数:7,代码来源:widgets.py


示例4: render

 def render(self, name, value, attrs=None, choices=()):
     if value is None:
         value = []
     final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
     return mark_safe(
         u"\n".join([(u"<input%s />" % flatatt(dict(value=force_unicode(v), **final_attrs))) for v in value])
     )
开发者ID:faridani,项目名称:Mturk-Tracker,代码行数:7,代码来源:widgets.py


示例5: tag

 def tag(self):
     if 'id' in self.attrs:
         self.attrs['id'] = '%s_%s' % (self.attrs['id'], self.index)
     final_attrs = dict(self.attrs, type='radio', name=self.name, value=self.choice_value)
     if self.is_checked():
         final_attrs['checked'] = 'checked'
     return mark_safe(u'<input%s />' % flatatt(final_attrs))
开发者ID:FashtimeDotCom,项目名称:MoleSys,代码行数:7,代码来源:widgets.py


示例6: tag

 def tag(self):
     if self.attrs.has_key("id"):
         self.attrs["id"] = "%s_%s" % (self.attrs["id"], self.index)
     final_attrs = dict(self.attrs, type="radio", name=self.name, value=self.choice_value)
     if self.is_checked():
         final_attrs["checked"] = "checked"
     return u"<input%s />" % flatatt(final_attrs)
开发者ID:JWW81,项目名称:stochss,代码行数:7,代码来源:widgets.py


示例7: render

 def render(self, name, value, attrs=None, choices=()):
     if value is None: value = []
     final_attrs = self.build_attrs(attrs, name=name)
     output = [u'<select multiple="multiple"%s>' % flatatt(final_attrs)]
     str_values = set([smart_unicode(v) for v in value]) # Normalize to strings.
     for option_value, option_label in chain(self.choices, choices):
         option_value = smart_unicode(option_value)
         selected_html = (option_value in str_values) and ' selected="selected"' or ''
         output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(smart_unicode(option_label))))
     output.append(u'</select>')
     return u'\n'.join(output)
开发者ID:alatteri,项目名称:informer,代码行数:11,代码来源:widgets.py


示例8: render_option

 def render_option(self, selected_choices, option_value, option_label, *args, **kw):
     option_value = force_text(option_value)
     selected_html = ''
     if args and type(args[0]) == type({}):
         selected_html += flatatt(args[0])
     if option_value in selected_choices:
         selected_html += ' selected="selected"'
         if not self.allow_multiple_selected:
             # Only allow for a single selection.
             selected_choices.remove(option_value)
     selected_html = mark_safe(selected_html)
     return format_html('<option value="{0}"{1}>{2}</option>',
             option_value, selected_html, force_text(option_label))
开发者ID:marcin-koziol,项目名称:django-html5-forms,代码行数:13,代码来源:widgets.py


示例9: render

 def render(self, name, value, attrs=None, choices=()):
     if value is None: value = ''
     final_attrs = self.build_attrs(attrs, name=name)
     output = [u'<select%s>' % flatatt(final_attrs)]
     # Normalize to string.
     str_value = force_unicode(value)
     for option_value, option_label in chain(self.choices, choices):
         option_value = force_unicode(option_value)
         selected_html = (option_value == str_value) and u' selected="selected"' or ''
         output.append(u'<option value="%s"%s>%s</option>' % (
                 escape(option_value), selected_html,
                 conditional_escape(force_unicode(option_label))))
     output.append(u'</select>')
     return mark_safe(u'\n'.join(output))
开发者ID:rawwell,项目名称:django,代码行数:14,代码来源:widgets.py


示例10: label_tag

    def label_tag(self, contents=None, attrs=None):
        """
        Wraps the given contents in a <label>, if the field has an ID attribute.
        Does not HTML-escape the contents. If contents aren't given, uses the
        field's HTML-escaped label.

        If attrs are given, they're used as HTML attributes on the <label> tag.
        """
        contents = contents or conditional_escape(self.label)
        widget = self.field.widget
        id_ = widget.attrs.get('id') or self.auto_id
        if id_:
            attrs = attrs and flatatt(attrs) or ''
            contents = u'<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, unicode(contents))
        return mark_safe(contents)
开发者ID:GoSteven,项目名称:Diary,代码行数:15,代码来源:forms.py


示例11: render

 def render(self, name, value, attrs=None):
     if value is None: value = ''
     final_attrs = self.build_attrs(attrs, type=self.input_type, name=name,
         dojoType='dijit.form.DateTextBox', lang='ru-ru', constraints="{datePattern:'dd.MM.yyyy'}", promptMessage="dd.MM.yyyy")
     if value != '': final_attrs['value'] = force_unicode(value) # Only add the 'value' attribute if a value is non-empty.
     return mark_safe(u'<input%s />' % flatatt(final_attrs))
开发者ID:Ferencz,项目名称:serpantin,代码行数:6,代码来源:widgets.py



注:本文中的util.flatatt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.get_required_param函数代码示例发布时间:2022-05-27
下一篇:
Python util.fix函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap