fix docs update endpoint

This commit is contained in:
Michael Shamoon 2022-05-16 00:13:25 -07:00
parent 063f6c1d5a
commit c398f22e76

View File

@ -209,7 +209,7 @@ class DocumentSerializer(DynamicFieldsModelSerializer):
original_file_name = SerializerMethodField() original_file_name = SerializerMethodField()
archived_file_name = SerializerMethodField() archived_file_name = SerializerMethodField()
created_date = serializers.DateField() created_date = serializers.DateField(required=False)
def get_original_file_name(self, obj): def get_original_file_name(self, obj):
return obj.get_public_filename() return obj.get_public_filename()
@ -228,6 +228,8 @@ class DocumentSerializer(DynamicFieldsModelSerializer):
) )
instance.created = new_datetime instance.created = new_datetime
instance.save() instance.save()
validated_data.pop("created_date")
super().update(instance, validated_data)
return instance return instance
class Meta: class Meta: