Skip to content

Commit 8638d42

Browse files
feat: set default owner for cycle creation if not provided
* Updated CycleListCreateAPIEndpoint to assign the current user as the owner when the 'owned_by' field is not included in the request data. * Enhanced the CycleCreateSerializer initialization to ensure proper ownership assignment during cycle creation.
1 parent 6d3d9e6 commit 8638d42

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/api/plane/api/views/cycle.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ def post(self, request, slug, project_id):
315315
request.data.get("start_date", None) is not None
316316
and request.data.get("end_date", None) is not None
317317
):
318-
serializer = CycleCreateSerializer(data=request.data)
318+
319+
# If owned_by is not provided, set it to the current user
320+
data = request.data
321+
if not data.get("owned_by"):
322+
data["owned_by"] = request.user.id
323+
324+
serializer = CycleCreateSerializer(data=data)
319325
if serializer.is_valid():
320326
if (
321327
request.data.get("external_id")

0 commit comments

Comments
 (0)