code: 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(escapedf _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)
docs: Escapes quotes with a backslash, except those inside a Django tag