Python django.utils.html 模块,strip_spaces_between_tags() 实例源码

我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用django.utils.html.strip_spaces_between_tags()

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())
项目:deb-python-coffin    作者:openstack    | 项目源码 | 文件源码
def _strip_spaces(self, caller=None):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(caller().strip())

# nicer import names
项目:lifesoundtrack    作者:MTG    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())
项目:deb-python-django-compressor    作者:openstack    | 项目源码 | 文件源码
def _spaceless(self, caller):
        from django.utils.html import strip_spaces_between_tags

        return strip_spaces_between_tags(caller().strip())
项目:liberator    作者:libscie    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())
项目:wger-lycan-clan    作者:andela    | 项目源码 | 文件源码
def render(self, context):
        if settings.WGER_SETTINGS['REMOVE_WHITESPACE']:
            from django.utils.html import strip_spaces_between_tags
            return strip_spaces_between_tags(self.nodelist.render(context).strip())
        else:
            return self.nodelist.render(context)
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())
项目:djangocms-attributes-field    作者:divio    | 项目源码 | 文件源码
def _render_row(self, key, value, field_name, key_attrs, val_attrs):
        """
        Renders to HTML a single key/value pair row.

        :param key: (str) key
        :param value: (str) value
        :param field_name: (str) String name of this field
        :param key_attrs: (dict) HTML attributes to be applied to the key input
        :param val_attrs: (dict) HTML attributes to be applied to the value input
        """
        template = """
        <div class="form-row attributes-pair">
            <div class="field-box">
               <input type="text" class="attributes-key" name="attributes_key[{field_name}]" value="{key}" {key_attrs}>
            </div>
            <div class="field-box">
               <input type="text" class="attributes-value"
                      name="attributes_value[{field_name}]"
                      value="{value}" {val_attrs}>
                <a class="delete-attributes-pair deletelink" href="#" title="{remove}"></a>
            </div>
        </div>
        """.format(
            key=escape(key),
            value=escape(value),
            field_name=field_name,
            key_attrs=key_attrs,
            val_attrs=val_attrs,
            remove=_('Remove'),
        )

        return strip_spaces_between_tags(template.strip())
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip())