mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-15 10:43:15 +00:00
Workaround a bug with django-modelcluster not committing m2m fields on form save. Fixes #192
This commit is contained in:
parent
1c146648e1
commit
e857b630c8
1 changed files with 10 additions and 2 deletions
|
|
@ -313,7 +313,13 @@ def edit(request, page_id):
|
|||
approved_go_live_at = go_live_at
|
||||
else:
|
||||
page.live = True
|
||||
form.save()
|
||||
|
||||
# We need save the page this way to workaround a bug
|
||||
# in django-modelcluster causing m2m fields to not
|
||||
# be committed to the database. See github issue #192
|
||||
form.save(commit=False)
|
||||
page.save()
|
||||
|
||||
# Clear approved_go_live_at for older revisions
|
||||
page.revisions.update(
|
||||
submitted_for_moderation=False,
|
||||
|
|
@ -328,7 +334,9 @@ def edit(request, page_id):
|
|||
Page.objects.filter(id=page.id).update(has_unpublished_changes=True)
|
||||
else:
|
||||
page.has_unpublished_changes = True
|
||||
form.save()
|
||||
form.save(commit=False)
|
||||
page.save()
|
||||
|
||||
|
||||
page.save_revision(
|
||||
user=request.user,
|
||||
|
|
|
|||
Loading…
Reference in a new issue