Cannot delete with overridden ModelAdmin.save_formset()

142 views
Skip to first unread message

Carsten Fuchs

unread,
Apr 20, 2015, 9:29:23 AM4/20/15
to django...@googlegroups.com
Dear Django fellows,

I use a ModelAdmin.save_formset() method exactly like in the Django Admin documentation:
https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset

This is the exact code:

def save_formset(self, request, form, formset, change):
if formset.model == AUB:
instances = formset.save(commit=False)

for instance in instances:
# For testing, intentionally do nothing else here!
instance.save()

formset.save_m2m()
else:
return super(StaffAdmin, self).save_formset(request, form, formset, change)


The problem is, if I check the "delete?" checkbox of an AUB inline instance in order to
delete it, there is no error, but the instance is not deleted.

Why is this, and what can I do please?

Many thanks and best regards,
Carsten

Carsten Fuchs

unread,
Apr 20, 2015, 10:04:19 AM4/20/15
to django...@googlegroups.com
Hi all,

Am 20.04.2015 um 15:29 schrieb Carsten Fuchs:
> I use a ModelAdmin.save_formset() method exactly like in the Django Admin documentation:
> https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset
>
> [...]
>
> The problem is, if I check the "delete?" checkbox of an AUB inline instance in order to
> delete it, there is no error, but the instance is not deleted.


Found the problem, along with suggested solution/improvement:
https://code.djangoproject.com/ticket/24668

Best regards,
Carsten
Reply all
Reply to author
Forward
0 new messages