1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #24668 -- Amended ModelAdmin.save_formset() example for #10284.

Thanks Carsten Fuchs.
This commit is contained in:
Tim Graham 2015-04-20 10:45:05 -04:00
parent fb267a1d85
commit e15c55e2bf

View File

@ -1259,6 +1259,8 @@ templates used by the :class:`ModelAdmin` views:
class ArticleAdmin(admin.ModelAdmin):
def save_formset(self, request, form, formset, change):
instances = formset.save(commit=False)
for obj in formset.deleted_objects:
obj.delete()
for instance in instances:
instance.user = request.user
instance.save()