update files and model to include new field

This commit is contained in:
Gwyn Hannay 2022-06-18 08:10:22 +08:00 committed by Trenton Holmes
parent 0878a199f4
commit 3fcbd8f3ac
5 changed files with 15 additions and 0 deletions

View File

@ -7,5 +7,7 @@ export interface PaperlessDocumentMetadata {
media_filename?: string media_filename?: string
original_filename?: string
has_archive_version?: boolean has_archive_version?: boolean
} }

View File

@ -42,6 +42,7 @@ class DocumentAdmin(admin.ModelAdmin):
"checksum", "checksum",
"archive_filename", "archive_filename",
"archive_checksum", "archive_checksum",
"original_filename",
) )
list_display_links = ("title",) list_display_links = ("title",)

View File

@ -475,6 +475,7 @@ class Consumer(LoggingMixin):
created=create_date, created=create_date,
modified=create_date, modified=create_date,
storage_type=storage_type, storage_type=storage_type,
original_filename=self.filename
) )
self.apply_overrides(document) self.apply_overrides(document)

View File

@ -214,6 +214,16 @@ class Document(models.Model):
help_text=_("Current archive filename in storage"), help_text=_("Current archive filename in storage"),
) )
original_filename = models.FilePathField(
_("original filename"),
max_length=1024,
editable=False,
default=None,
unique=False,
null=True,
help_text=_("The original name of the file when it was uploaded")
)
archive_serial_number = models.IntegerField( archive_serial_number = models.IntegerField(
_("archive serial number"), _("archive serial number"),
blank=True, blank=True,

View File

@ -313,6 +313,7 @@ class DocumentViewSet(
"original_metadata": self.get_metadata(doc.source_path, doc.mime_type), "original_metadata": self.get_metadata(doc.source_path, doc.mime_type),
"archive_checksum": doc.archive_checksum, "archive_checksum": doc.archive_checksum,
"archive_media_filename": doc.archive_filename, "archive_media_filename": doc.archive_filename,
"original_filename": doc.original_filename,
} }
if doc.has_archive_version: if doc.has_archive_version: