Merge pull request #4448 from normanjaeckel/SetStateView
Set state view
This commit is contained in:
commit
4174f70d2b
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user