[Plugin] schedule: Fix create event with EventType Object

This commit is contained in:
Ferdinand Thiessen 2021-01-26 21:32:13 +01:00
parent 2ca8d3b324
commit a8c7ddae3d
1 changed files with 4 additions and 1 deletions

View File

@ -254,7 +254,10 @@ def create_event(current_session):
data = request.get_json()
try:
start = from_iso_format(data["start"])
event_type = event_controller.get_event_type(data["type"])
data_type = data["type"]
if isinstance(data_type, dict):
data_type = data["type"]["id"]
event_type = event_controller.get_event_type(data_type)
except (NotFound, KeyError, ValueError):
raise BadRequest("Missing POST parameter")