mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-15 10:13:15 -05:00
Fix: disable custom field signals during import in 2.13.0 (#8065)
This commit is contained in:
parent
1888ee6a3f
commit
0d96cd03d5
@ -34,6 +34,7 @@ from documents.settings import EXPORTER_ARCHIVE_NAME
|
|||||||
from documents.settings import EXPORTER_CRYPTO_SETTINGS_NAME
|
from documents.settings import EXPORTER_CRYPTO_SETTINGS_NAME
|
||||||
from documents.settings import EXPORTER_FILE_NAME
|
from documents.settings import EXPORTER_FILE_NAME
|
||||||
from documents.settings import EXPORTER_THUMBNAIL_NAME
|
from documents.settings import EXPORTER_THUMBNAIL_NAME
|
||||||
|
from documents.signals.handlers import update_cf_instance_documents
|
||||||
from documents.signals.handlers import update_filename_and_move_files
|
from documents.signals.handlers import update_filename_and_move_files
|
||||||
from documents.utils import copy_file_with_basic_stats
|
from documents.utils import copy_file_with_basic_stats
|
||||||
from paperless import version
|
from paperless import version
|
||||||
@ -242,6 +243,7 @@ class Command(CryptMixin, BaseCommand):
|
|||||||
|
|
||||||
self.decrypt_secret_fields()
|
self.decrypt_secret_fields()
|
||||||
|
|
||||||
|
# see /src/documents/signals/handlers.py
|
||||||
with (
|
with (
|
||||||
disable_signal(
|
disable_signal(
|
||||||
post_save,
|
post_save,
|
||||||
@ -253,6 +255,16 @@ class Command(CryptMixin, BaseCommand):
|
|||||||
receiver=update_filename_and_move_files,
|
receiver=update_filename_and_move_files,
|
||||||
sender=Document.tags.through,
|
sender=Document.tags.through,
|
||||||
),
|
),
|
||||||
|
disable_signal(
|
||||||
|
post_save,
|
||||||
|
receiver=update_filename_and_move_files,
|
||||||
|
sender=CustomFieldInstance,
|
||||||
|
),
|
||||||
|
disable_signal(
|
||||||
|
post_save,
|
||||||
|
receiver=update_cf_instance_documents,
|
||||||
|
sender=CustomField,
|
||||||
|
),
|
||||||
):
|
):
|
||||||
if settings.AUDIT_LOG_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
auditlog.unregister(Document)
|
auditlog.unregister(Document)
|
||||||
|
@ -365,6 +365,7 @@ class CannotMoveFilesException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# should be disabled in /src/documents/management/commands/document_importer.py handle
|
||||||
@receiver(models.signals.post_save, sender=CustomField)
|
@receiver(models.signals.post_save, sender=CustomField)
|
||||||
def update_cf_instance_documents(sender, instance: CustomField, **kwargs):
|
def update_cf_instance_documents(sender, instance: CustomField, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -379,6 +380,7 @@ def update_cf_instance_documents(sender, instance: CustomField, **kwargs):
|
|||||||
update_filename_and_move_files(sender, cf_instance)
|
update_filename_and_move_files(sender, cf_instance)
|
||||||
|
|
||||||
|
|
||||||
|
# should be disabled in /src/documents/management/commands/document_importer.py handle
|
||||||
@receiver(models.signals.post_save, sender=CustomFieldInstance)
|
@receiver(models.signals.post_save, sender=CustomFieldInstance)
|
||||||
@receiver(models.signals.m2m_changed, sender=Document.tags.through)
|
@receiver(models.signals.m2m_changed, sender=Document.tags.through)
|
||||||
@receiver(models.signals.post_save, sender=Document)
|
@receiver(models.signals.post_save, sender=Document)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user