diff --git a/arkindex/documents/api/elements.py b/arkindex/documents/api/elements.py index 41df04fa10ddec50671b02d10a561160e4935555..0f6a7cfcfbcd510a1b0d7a036f5afdb68ec25002 100644 --- a/arkindex/documents/api/elements.py +++ b/arkindex/documents/api/elements.py @@ -1309,15 +1309,6 @@ class ElementNeighbors(ACLMixin, ListAPIView): post=extend_schema( operation_id='CreateElementParent', description='Link an element to a new parent', - parameters=[ - OpenApiParameter( - 'type_ordering', - type=bool, - default=True, - description='Add the child element at the last position in the parent relative to ' - 'only the elements of the same type, or to all elements.', - ) - ], ), delete=extend_schema( operation_id='DestroyElementParent', @@ -1331,12 +1322,8 @@ class ElementParent(CreateAPIView, DestroyAPIView): serializer_class = ElementParentSerializer permission_classes = (IsVerified, ) - @property - def type_ordering(self): - return self.request.query_params.get('type_ordering', 'true').lower() not in ('0', 'false') - def get_serializer_from_params(self, child=None, parent=None, **kwargs): - data = {'child': child, 'parent': parent, 'type_ordering': self.type_ordering} + data = {'child': child, 'parent': parent} kwargs['context'] = self.get_serializer_context() return ElementParentSerializer(data=data, **kwargs) diff --git a/arkindex/documents/models.py b/arkindex/documents/models.py index b4990d7dac5c5cc3972bd102c4e9b3fa935916ea..22f2421ffab3c81872eb315c660417ca68273278 100644 --- a/arkindex/documents/models.py +++ b/arkindex/documents/models.py @@ -274,7 +274,7 @@ class Element(IndexableModel): Element.objects.filter(id=self.id)._raw_delete(using='default') @transaction.atomic - def add_parent(self, parent, skip_children=False, type_ordering=True): + def add_parent(self, parent, skip_children=False): ''' Add an element as ancestor ''' diff --git a/arkindex/documents/serializers/elements.py b/arkindex/documents/serializers/elements.py index 91bbbdc8220676750893b04256766e9c64e35b88..4cc609cd3312e1f8dc0d22d75676fad6ed2abbc3 100644 --- a/arkindex/documents/serializers/elements.py +++ b/arkindex/documents/serializers/elements.py @@ -492,11 +492,6 @@ class ElementParentSerializer(serializers.Serializer): """ child = serializers.PrimaryKeyRelatedField(queryset=Element.objects.none()) parent = serializers.PrimaryKeyRelatedField(queryset=Element.objects.none()) - type_ordering = serializers.BooleanField( - default=True, - help_text='Add the child element at the last position in the parent relative to ' - 'only the elements of the same type, or to all elements.', - ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -536,9 +531,8 @@ class ElementParentSerializer(serializers.Serializer): def create(self, validated_data): child = validated_data['child'] parent = validated_data['parent'] - type_ordering = validated_data['type_ordering'] self.perform_create_checks(child, parent) - child.add_parent(parent, type_ordering=type_ordering) + child.add_parent(parent) def delete(self, validated_data): child = validated_data['child']