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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

FernandoJMM
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

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

Matemática A3K
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?

On Sat, Jan 13, 2018 at 11:12 AM, FernandoJMM <[hidden email]> wrote:
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CA%2BFDnh%2BwdiQvM550ZXQN2-xVybqCS98mC_xXFef7QWdpK4i6bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Matemática A3K


On Tue, Jan 16, 2018 at 6:15 PM, Matemática A3K <[hidden email]> 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?

 

On Sat, Jan 13, 2018 at 11:12 AM, FernandoJMM <[hidden email]> wrote:
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.


--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CA%2BFDnhKpHvZ7S1be6AaY0D-NaGnB4%2BjcqO8aVKb7aS_oS2GSww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.