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}."} {"detail": f"You can not set the state to {state_id}."}
) )
motion.set_state(state_id) motion.set_state(state_id)
state = State.objects.get(pk=state_id)
# Save motion. # Save motion.
if not state.dont_set_identifier: motion.save(
motion.save( update_fields=[
update_fields=["state", "last_modified", "identifier"], "state",
skip_autoupdate=True, "identifier",
) "identifier_number",
else: "last_modified",
motion.save( ],
update_fields=["state", "last_modified"], skip_autoupdate=True skip_autoupdate=True,
) )
# Write the log message. # Write the log message.
motion.write_log( motion.write_log(