fix(core): dont exclude self for ticket comment category if not exists

ref: #392
This commit is contained in:
2024-11-26 00:37:33 +09:30
parent 2647bbd522
commit cad845267c

View File

@ -91,8 +91,10 @@ class TicketCommentCategoryModelSerializer(
if 'view' in self._context:
if(
self._context['view'].action == 'partial_update'
or self._context['view'].action == 'update'
(
self._context['view'].action == 'partial_update'
or self._context['view'].action == 'update'
) and getattr(self.instance, 'pk', None)
):
self.fields['parent'].queryset = self.fields['parent'].queryset.exclude(