A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
fix bug on administration exporter when using -d, --delete option
Matthieu Helleboidfae5e834b93e
diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.pyindex 12828a7a0..9ce0f5f62 100644--- a/src/documents/management/commands/document_exporter.py+++ b/src/documents/management/commands/document_exporter.py@@ -350,6 +350,8 @@ class Command(BaseCommand):if self.use_filename_prefix:manifest_name = os.path.join("json", manifest_name)manifest_name = os.path.join(self.target, manifest_name)+ if manifest_name in self.files_in_export_dir:+ self.files_in_export_dir.remove(manifest_name)os.makedirs(os.path.dirname(manifest_name), exist_ok=True)with open(manifest_name, "w") as f:json.dump([document_manifest[index]], f, indent=2)@@ -357,19 +359,20 @@ class Command(BaseCommand):# 4.1 write manifest to target foldermanifest_path = (self.target / Path("manifest.json")).resolve()manifest_path.write_text(json.dumps(manifest, indent=2))+ if manifest_path in self.files_in_export_dir:+ self.files_in_export_dir.remove(manifest_path)# 4.2 write version information to target folderversion_path = (self.target / Path("version.json")).resolve()version_path.write_text(json.dumps({"version": version.__full_version_str__}, indent=2),)+ if version_path in self.files_in_export_dir:+ self.files_in_export_dir.remove(version_path)if self.delete:# 5. Remove files which we did not explicitly export in this run- if manifest_path in self.files_in_export_dir:- self.files_in_export_dir.remove(manifest_path)-for f in self.files_in_export_dir:f.unlink()