Add natural keys to the document type model
This commit is contained in:
@@ -32,7 +32,8 @@ from converter.literals import (DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION,
|
||||
from .conf.settings import (CHECKSUM_FUNCTION, UUID_FUNCTION,
|
||||
STORAGE_BACKEND, DISPLAY_SIZE, CACHE_PATH,
|
||||
ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL)
|
||||
from .managers import DocumentPageTransformationManager, RecentDocumentManager
|
||||
from .managers import (DocumentPageTransformationManager, RecentDocumentManager,
|
||||
DocumentTypeManager)
|
||||
from .utils import document_save_to_temp_dir
|
||||
from .literals import (RELEASE_LEVEL_FINAL, RELEASE_LEVEL_CHOICES,
|
||||
VERSION_UPDATE_MAJOR, VERSION_UPDATE_MINOR, VERSION_UPDATE_MICRO)
|
||||
@@ -60,9 +61,14 @@ class DocumentType(models.Model):
|
||||
"""
|
||||
name = models.CharField(max_length=32, verbose_name=_(u'name'), unique=True)
|
||||
|
||||
objects = DocumentTypeManager()
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
def natural_key(self):
|
||||
return (self.name,)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _(u'document type')
|
||||
verbose_name_plural = _(u'documents types')
|
||||
|
||||
Reference in New Issue
Block a user