Files
mayan-edms/mayan/apps/file_metadata/managers.py
Roberto Rosario 0a7908baca File metadata: Add file metadata app
Add the file metadata app. This app uses binary wrappers called drivers
to extract properties from the file of documents. The default driver
uses the exiftool to extract the EXIF record from JPEG images.
The exiftool can also extra some properties from other files like
PDFs, office files and sound file.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2018-12-14 02:16:38 -04:00

24 lines
660 B
Python

from __future__ import unicode_literals
import logging
from django.apps import apps
from django.db import models
logger = logging.getLogger(__name__)
class DocumentTypeSettingsManager(models.Manager):
def get_by_natural_key(self, document_type_natural_key):
DocumentType = apps.get_model(
app_label='documents', model_name='DocumentType'
)
try:
document_type = DocumentType.objects.get_by_natural_key(
document_type_natural_key
)
except DocumentType.DoesNotExist:
raise self.model.DoesNotExist
return self.get(document_type__pk=document_type.pk)