Merge pull request #4448 from normanjaeckel/SetStateView

Set state view
This commit is contained in:
Emanuel Schütze 2019-03-04 11:17:33 +01:00 committed by GitHub
commit 4174f70d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -666,18 +666,17 @@ class MotionViewSet(ModelViewSet):
{"detail": f"You can not set the state to {state_id}."}
)
motion.set_state(state_id)
state = State.objects.get(pk=state_id)
# Save motion.
if not state.dont_set_identifier:
motion.save(
update_fields=["state", "last_modified", "identifier"],
update_fields=[
"state",
"identifier",
"identifier_number",
"last_modified",
],
skip_autoupdate=True,
)
else:
motion.save(
update_fields=["state", "last_modified"], skip_autoupdate=True
)
# Write the log message.
motion.write_log(