def get_or_create_task_type( department, name, color="#888888", priority=1, for_shots=False, for_entity="Asset", short_name="", shotgun_id=None ): """ Create a new task type if it doesn't exist. If it exists, it returns the type from database. """ task_type = TaskType.get_by(name=name) if task_type is None: task_type = TaskType( name=name, short_name=short_name, department_id=department["id"], color=color, priority=priority, for_shots=for_shots, shotgun_id=shotgun_id ) task_type.save() return task_type.serialize()
def get_or_create_task_type(department, name, color="#888888", priority=1, for_shots=False): task_type = TaskType.get_by(name=name) if task_type is None: task_type = TaskType(name=name, department_id=department["id"], color=color, priority=priority, for_shots=for_shots) task_type.save() return task_type.serialize()