Using the ModelAdmin.inlines class, there is no DELETE button

341 views
Skip to first unread message

FernandoJMM

unread,
Jan 13, 2018, 9:12:49 AM1/13/18
to Django users
Good Morning,

I'm customizing the ModelAdmin class inlines attribute. The code is this.

class NaveInline(admin.TabularInline):
    model = Nave
    fields = ['codigoNave', 'nave', 'tipoPuesta']
    ordering = ['codigoNave']
    extra = 1


class GranjaAdmin(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields': [('codigoGranja', 'granja'), ('empresa', 'tipoGranja'), ('regimen')]}),
        ('Datos adicionales', {'fields': [('direccion', 'localidad', 'codigoPostal', 
        'provincia', 'region', 'pais', 'telefonoPrincipal', 'telefonoMovil', 
        'fax', 'email', 'ceence','cea', 'maquina', 'clasificacionZootecnica', 
        'formaDeCria', 'notas')], 'classes': ['collapse']}),
    ]

    inlines = [NaveInline]
 
. . . . . .  


Everything works perfectly, I can add granjas / naves, edit granjas / naves, and clear granjas. . but I can not do it is to delete naves that in this case are the lines (inlines).

I do not get any errors, I can see the line selection check but the line deletion button DOES NOT APPEAR.

Thanks for your help,
Fernando

Matemática A3K

unread,
Jan 16, 2018, 4:17:01 PM1/16/18
to django...@googlegroups.com
According to https://code.djangoproject.com/ticket/15910:
"When adding a form to an inline formset in the admin interface it has a nice "Remove" link added automatically. These links are however missing from empty rows that have been created as a result from the "extra" option. They are also removed when the form is saved and validation of the form as a whole fails"

Could be that something is invalid and you are not rendering errors in the template?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c21e2ff0-a1d0-4f83-b6c9-bc91a8d1e7e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matemática A3K

unread,
Jan 16, 2018, 4:21:10 PM1/16/18
to django...@googlegroups.com
On Tue, Jan 16, 2018 at 6:15 PM, Matemática A3K <matemat...@gmail.com> wrote:
According to https://code.djangoproject.com/ticket/15910:
"When adding a form to an inline formset in the admin interface it has a nice "Remove" link added automatically. These links are however missing from empty rows that have been created as a result from the "extra" option. They are also removed when the form is saved and validation of the form as a whole fails"

Could be that something is invalid and you are not rendering errors in the template?
This is unlikely, you are not overriding the admin's template, right?
Reply all
Reply to author
Forward
0 new messages