Add initial new document version class based view

This commit is contained in:
Roberto Rosario
2014-10-24 18:50:23 -04:00
parent c23205f464
commit 6a007492a8
4 changed files with 184 additions and 125 deletions
-33
View File
@@ -219,36 +219,3 @@ class DocumentDownloadForm(forms.Form):
if len(self.document_versions) > 1:
self.fields['compressed'].initial = True
self.fields['compressed'].widget.attrs.update({'disabled': True})
class NewVersionForm(forms.ModelForm):
class Meta:
model = DocumentVersion
'''
def version_fields(self, document):
self.fields['version_update'] = forms.ChoiceField(
label=_(u'Version update'),
choices=DocumentVersion.get_version_update_choices(document.latest_version)
)
self.fields['comment'] = forms.CharField(
label=_(u'Comment'),
required=False,
widget=forms.widgets.Textarea(attrs={'rows': 4}),
)
new_filename = forms.CharField(
label=_('New document filename'), required=False
)
def clean(self):
cleaned_data = self.cleaned_data
cleaned_data['new_version_data'] = {
'comment': self.cleaned_data.get('comment'),
'version_update': self.cleaned_data.get('version_update'),
}
# Always return the full collection of cleaned data.
return cleaned_data
'''