Documents: Split monolith forms.py
Split the documents/forms.py into sub modules for each logical unit: types, document, pages, versions. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
33
mayan/apps/documents/forms/document_version_forms.py
Normal file
33
mayan/apps/documents/forms/document_version_forms.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from ..fields import DocumentVersionField
|
||||
|
||||
from .document_forms import DocumentDownloadForm
|
||||
|
||||
__all__ = ('DocumentVersionDownloadForm', 'DocumentVersionPreviewForm')
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DocumentVersionDownloadForm(DocumentDownloadForm):
|
||||
preserve_extension = forms.BooleanField(
|
||||
label=_('Preserve extension'), required=False,
|
||||
help_text=_(
|
||||
'Takes the file extension and moves it to the end of the '
|
||||
'filename allowing operating systems that rely on file '
|
||||
'extensions to open the downloaded document version correctly.'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class DocumentVersionPreviewForm(forms.Form):
|
||||
document_version = DocumentVersionField()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
document_version = kwargs.pop('instance', None)
|
||||
super(DocumentVersionPreviewForm, self).__init__(*args, **kwargs)
|
||||
self.fields['document_version'].initial = document_version
|
||||
Reference in New Issue
Block a user