Skip to content
Snippets Groups Projects
Commit 5b6a197a authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Remove call to undefined method in MetaDataUpdateSerializer

parent e58cfc97
No related branches found
No related tags found
1 merge request!1448Remove call to undefined method in MetaDataUpdateSerializer
......@@ -171,23 +171,14 @@ class MetaDataLightSerializer(serializers.ModelSerializer):
if metadata.exists():
validated_data['index'] = metadata.aggregate(Max('index'))['index__max'] + 1
original_type = instance.type
updated_metadata = super().update(instance, validated_data)
if MetaType.Reference in (original_type, updated_metadata.type):
# Reindex element reference metadatas
self.reindex_element(updated_metadata.element)
return updated_metadata
return super().update(instance, validated_data)
def delete(self, instance):
user = self.context['request'].user
element, meta_type = instance.element, instance.type
if not (user.is_admin or user.is_internal):
self.check_allowed(corpus=element.corpus, instance=instance)
self.check_allowed(corpus=instance.element.corpus, instance=instance)
instance.delete()
if meta_type == MetaType.Reference:
# Reindex metadata's element
self.reindex_element(element)
class Meta:
model = MetaData
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment