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

285
Vistas
How to add crispy forms to bootstrap4 in Django?

I'm having a trouble to combine bootstrap upload form with django form (crispy forms). Any idea how to put crispy forms to bootstrap form.

This is django crispy forms

        <form method="post" enctype="multipart/form-data">
              {% csrf_token %}
              {{ form|crispy }}
              <button type="submit" class="btn btn-primary">Upload and Download!</button>
        </form>

This is bootstrap form where I want to put crispy form.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="custom-file">
  <input type="file" class="custom-file-input" id="customFile">
  <label class="custom-file-label" for="customFile">Choose file</label>
</div>

Any idea how to combine these two?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

you can do something like this

        <form action="." method='POST' enctype="multipart/form-data">
        {% csrf_token %}
    <div class="custom-file">
  <input type="file" class="custom-file-input" name="file" id="customFile">
  <label class="custom-file-label" for="customFile">Choose file</label>
</div> <br><br>
    <button type="submit" class="btn btn-primary">Upload and Download!</button>
    </form>

and add this to the head of your page

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

and in your views.py to get the file you can use files = request.Files['file']

over 4 years ago · Santiago Trujillo 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