mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Make DocumentSerializer return the original_filename
Make get_original_file_name return the original filename instead of the public filename.
This commit is contained in:
parent
c1641f6fb8
commit
6542d75a6a
@ -414,7 +414,7 @@ class DocumentSerializer(OwnedObjectSerializer, DynamicFieldsModelSerializer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_original_file_name(self, obj):
|
def get_original_file_name(self, obj):
|
||||||
return obj.get_public_filename()
|
return obj.original_filename
|
||||||
|
|
||||||
def get_archived_file_name(self, obj):
|
def get_archived_file_name(self, obj):
|
||||||
if obj.has_archive_version:
|
if obj.has_archive_version:
|
||||||
|
@ -579,6 +579,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||||||
content="things i paid for in september",
|
content="things i paid for in september",
|
||||||
pk=3,
|
pk=3,
|
||||||
checksum="C",
|
checksum="C",
|
||||||
|
original_filename="someepdf.pdf",
|
||||||
)
|
)
|
||||||
with AsyncWriter(index.open_index()) as writer:
|
with AsyncWriter(index.open_index()) as writer:
|
||||||
# Note to future self: there is a reason we dont use a model signal handler to update the index: some operations edit many documents at once
|
# Note to future self: there is a reason we dont use a model signal handler to update the index: some operations edit many documents at once
|
||||||
@ -598,6 +599,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||||||
self.assertEqual(response.data["count"], 1)
|
self.assertEqual(response.data["count"], 1)
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertCountEqual(response.data["all"], [d3.id])
|
self.assertCountEqual(response.data["all"], [d3.id])
|
||||||
|
self.assertEqual(results[0]["original_file_name"], "someepdf.pdf")
|
||||||
|
|
||||||
response = self.client.get("/api/documents/?query=statement")
|
response = self.client.get("/api/documents/?query=statement")
|
||||||
results = response.data["results"]
|
results = response.data["results"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user