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

256
Vistas
How to convert list from python into comma separated values in python with jinja or javascript

I want to synchronize my dropzone allowfiles templates with my python upload config allowed files. I can get jinja to spit out my UPLOAD_EXTENSIONS with config.UPLOAD_EXTENSIONS but I can not figure out how to format it into a string that can be used in my javascript allowdfiles format. See below for what I get vs what I want.

jinja html template

<script>
    let allowed_files = "{{ config.UPLOAD_EXTENSIONS }}";
    console.log(allowed_files)
</script>

Console Log

[&#39;.jpg&#39;, &#39;.png&#39;, &#39;.gif&#39;]

What I want is this string

.jpg,.png,.gif
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should use safe filter like this:

<script>
    let allowed_files = "{{ config.UPLOAD_EXTENSIONS|safe }}";
    console.log(allowed_files)
</script>

but it returns a result like this:

[".jpg", ".png", ".gif"]

If you want the exact use: console.log(allowed_files.join())

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