diff --git a/apps/documents/forms.py b/apps/documents/forms.py index 415ea8fa64..be2c41b3db 100644 --- a/apps/documents/forms.py +++ b/apps/documents/forms.py @@ -131,6 +131,8 @@ class DocumentForm(forms.ModelForm): model = Document exclude = ('description',) + new_filename = forms.CharField(label=_('New document filename'), required=False) + class DocumentPreviewForm(forms.Form): def __init__(self, *args, **kwargs): @@ -171,8 +173,6 @@ class DocumentForm_edit(DocumentForm): model = Document exclude = ('file', 'document_type') - new_filename = forms.CharField(label=_(u'New document filename'), required=False) - class StagingDocumentForm(forms.Form): def __init__(self, *args, **kwargs): @@ -192,6 +192,7 @@ class StagingDocumentForm(forms.Form): label=_(u'Quick document rename')) staging_file_id = forms.ChoiceField(label=_(u'Staging file')) + new_filename = forms.CharField(label=_('New document filename'), required=False) class DocumentTypeSelectForm(forms.Form): diff --git a/apps/documents/views.py b/apps/documents/views.py index 35bc5aa7e4..34dc44fdee 100644 --- a/apps/documents/views.py +++ b/apps/documents/views.py @@ -115,6 +115,9 @@ def document_create_sibling(request, document_id, multiple=True): def _handle_save_document(request, document, form=None): RecentDocument.objects.add_document_for_user(request.user, document) + if form.cleaned_data['new_filename']: + document.file_filename = form.cleaned_data['new_filename'] + document.save() if form and 'document_type_available_filenames' in form.cleaned_data: if form.cleaned_data['document_type_available_filenames']: