Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
Is there any 'safe' keyword of Django template filter in Python or JavaScript?

I'm using ckeditor for description field which allows the user to format text.

This is what I'm saving in my description field:

<div class="ql-editor" data-gramm="false" data-placeholder="Compose an epic..." contenteditable="true">
<p><strong>Lösungen, die mit Ihrem Unternehmen wachsen. Gern berate ich Sie zu allen Steuerfragen. Vereinbaren Sie ein individuelles Informationsgespräch. Annette Wolff Ι Steuerberaterin</strong></p>
</div>
<div class="ql-clipboard" tabindex="-1" contenteditable="true">
</div>
<div class="ql-tooltip ql-hidden">
<a class="ql-preview" target="_blank" href="about:blank"></a><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-action"></a><a class="ql-remove"></a>
</div>

To show it in a proper format I'm using description|safe filter in Django template which shows the description like this:

Lösungen, die mit Ihrem Unternehmen wachsen. Gern berate ich Sie zu allen Steuerfragen. Vereinbaren Sie ein individuelles Informationsgespräch. Annette Wolff Ι Steuerberaterin

But how can I handle it with an Ajax call as I cannot use the Django template safe filter keyword?

Is there any way to handle it in JavaScript, jQuery, or in a Python file?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can simply return description as your html using JsonResponse in your AJAX view:

from django.http import JsonResponse

def myview(request):
    html = "<h1>Some text</h1>"
    return JsonResponse(html, safe=False)

You can also use mark_safe as mark_safe(html) in your view

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda