def _escape_attribute_quotes(self, v):
        '''
        Escapes quotes with a backslash, except those inside a Django tag
        '''
        escaped = []
        inside_tag = False
        for i, _ in enumerate(v):
            if v[i:i + 2] == '{%':
                inside_tag = True
            elif v[i:i + 2] == '%}':
                inside_tag = False

            if v[i] == self.attr_wrapper and not inside_tag:
                escaped.append('\\')

            escaped.append(v[i])

        return ''.join(escaped)
def _escape_attribute_quotes ( self , v ) : escaped = [ ] inside_tag = False for i , _ in enumerate ( v ) : if v [ i : i + 2 ] == '{%' : inside_tag = True elif v [ i : i + 2 ] == '%}' : inside_tag = False if v [ i ] == self . attr_wrapper and not inside_tag : escaped . append ( '\\' ) escaped . append ( v [ i ] ) return '' . join ( escaped )
Escapes quotes with a backslash, except those inside a Django tag