Files
mayan-edms/mayan/apps/file_metadata/handlers.py
T
Roberto Rosario dcea32ae38 Refactor file metadata app
Add translatable label to the label admin method.

Add access association from DocumentVersionDriverEntry to
document version.

Enclose process method and event commit in a transaction.

Update process method to not error out if EXIF tool
is not found.

Update views and tests to use ExternalObjectMixin and
comply with MERCs 5 and 6.

Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@gmail.com>
2019-02-03 19:22:49 -04:00

22 lines
670 B
Python

from __future__ import unicode_literals
from django.apps import apps
from .settings import setting_auto_process
def handler_initialize_new_document_type_settings(sender, instance, **kwargs):
DocumentTypeSettings = apps.get_model(
app_label='file_metadata', model_name='DocumentTypeSettings'
)
if kwargs['created']:
DocumentTypeSettings.objects.create(
auto_process=setting_auto_process.value, document_type=instance
)
def handler_process_document_version(sender, instance, **kwargs):
if instance.document.document_type.file_metadata_settings.auto_process:
instance.submit_for_file_metadata_processing()