Skip to content

Commit

Permalink
[1.7.x] Fixed #24668 -- Amended ModelAdmin.save_formset() example for #…
Browse files Browse the repository at this point in the history
…10284.

Thanks Carsten Fuchs.

Backport of e15c55e from master
  • Loading branch information
timgraham committed Apr 20, 2015
1 parent 276f760 commit 32871fc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/ref/contrib/admin/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,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()
Expand Down

0 comments on commit 32871fc

Please sign in to comment.