Python django.utils.html.strip_spaces_between_tags() Examples

The following are 11 code examples of django.utils.html.strip_spaces_between_tags(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.utils.html , or try the search function .
Example #1
Source File: defaulttags.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #2
Source File: defaulttags.py    From bioforum with MIT License 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #3
Source File: models.py    From djangocms-gmaps with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_infowindow(self):
        if not self.infowindow or not settings.DJANGOCMS_GMAPS_INFOWINDOW_ENABLED:
            return ''

        rendered_infowindow = render_to_string(
            settings.DJANGOCMS_GMAPS_INFOWINDOW_TEMPLATE, {'location': self, })
        return {
            'content': strip_spaces_between_tags(rendered_infowindow.strip()),
            'maxWidth': settings.DJANGOCMS_GMAPS_INFOWINDOW_MAXWIDTH
        } 
Example #4
Source File: middleware.py    From opensurfaces with MIT License 5 votes vote down vote up
def process_response(self, request, response):
        if 'text/html' in response['Content-Type']:
            response.content = strip_spaces_between_tags(response.content)
        return response 
Example #5
Source File: defaulttags.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #6
Source File: defaulttags.py    From python with Apache License 2.0 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #7
Source File: validators.py    From richie with MIT License 5 votes vote down vote up
def clean(self, x):
        """Strip all HTML tags and useless spaces before counting the number of characters."""
        return len(strip_tags(strip_spaces_between_tags(x)).replace(" ", "")) 
Example #8
Source File: defaulttags.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #9
Source File: defaulttags.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #10
Source File: defaulttags.py    From python2017 with MIT License 5 votes vote down vote up
def render(self, context):
        from django.utils.html import strip_spaces_between_tags
        return strip_spaces_between_tags(self.nodelist.render(context).strip()) 
Example #11
Source File: middleware.py    From canvas with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def process_response(self, request, response):
        if 'text/html' in response['Content-Type'] and settings.MINIFY_HTML:
            #response.content = strip_spaces_between_tags(response.content)
            response.content = RE_MULTISPACE.sub(" ", response.content)
            response.content = RE_MULTIBOTH.sub("\n", response.content)
            response.content = RE_NEWLINE.sub("\n", response.content)
        return response


# Forked from Django to allow me to HTTPS-only the staff session