Convert the document version list view to item view mode.
Add document version preview and thumbnail widgets. Update the new version upload event have the version as the target and the document as the action object. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -56,6 +56,22 @@ class DocumentPreviewForm(forms.Form):
|
||||
preview = forms.CharField(widget=DocumentPagesCarouselWidget())
|
||||
|
||||
|
||||
class DocumentVersionPreviewForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
document_version = kwargs.pop('instance', None)
|
||||
super(DocumentVersionPreviewForm, self).__init__(*args, **kwargs)
|
||||
|
||||
self.fields['preview'].initial = document_version
|
||||
try:
|
||||
self.fields['preview'].label = _(
|
||||
'Document pages (%d)'
|
||||
) % document_version.pages.count()
|
||||
except AttributeError:
|
||||
self.fields['preview'].label = _('Document version pages (%d)') % 0
|
||||
|
||||
preview = forms.CharField(widget=DocumentPagesCarouselWidget())
|
||||
|
||||
|
||||
class DocumentForm(forms.ModelForm):
|
||||
"""
|
||||
Form sub classes from DocumentForm used only when editing a document
|
||||
|
||||
Reference in New Issue
Block a user