send autoupdate on state update for motions

This commit is contained in:
FinnStutzenstein 2019-04-16 15:45:59 +02:00
parent ebbb369124
commit 3eb5273b8e

View File

@ -1425,3 +1425,14 @@ class StateViewSet(
msg = self.getProtectedErrorMessage("workflow", err)
raise ValidationError({"detail": msg})
return result
def update(self, *args, **kwargs):
"""
Sends autoupdate for all motions that are affected by the state change.
Maybe the restriction was changed, so the view permission for some
motions could have been changed.
"""
result = super().update(*args, **kwargs)
state = self.get_object()
inform_changed_data(Motion.objects.filter(state=state))
return result