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

130
Vistas
Django crispy form with formset does not show delete checkbox

I have some code structure very similar to this example: https://gist.github.com/ibarovic/3092910

Everything is working pretty well, except that the delete checkbox after each Book element is not shown at all. If I change

{% crispy formset formset.form.helper %}

to

{% crispy formset %}

the delete checkboxes are shown, but the form does not work anymore (b/c the HTML form tags are used not only once).

I suspect that those checkboxes are not known to the BookForm (b/c they somehow get added later by the inlineformset_factory), so they do not get added to the layout and are ignored. I have no idea how to circumvent that though.

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

0

I found a solution thanks to this: Django crispy-forms, BaseGenericInlineFormSet & allow_delete

In the BookForm (which gets repeated many times) init, you can add something like:

self.helper = FormHelper(form=self) # or manual layout
self.helper.form_tag = False

i = self.helper.layout.fields.index('title')
self.helper.layout.insert(i+1, layout.Field("DELETE"))

The capital letters "DELETE" field then gets added to each single BookForm...

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