Added a direct rename field to the local update and staging upload forms
This commit is contained in:
@@ -131,6 +131,8 @@ class DocumentForm(forms.ModelForm):
|
|||||||
model = Document
|
model = Document
|
||||||
exclude = ('description',)
|
exclude = ('description',)
|
||||||
|
|
||||||
|
new_filename = forms.CharField(label=_('New document filename'), required=False)
|
||||||
|
|
||||||
|
|
||||||
class DocumentPreviewForm(forms.Form):
|
class DocumentPreviewForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -171,8 +173,6 @@ class DocumentForm_edit(DocumentForm):
|
|||||||
model = Document
|
model = Document
|
||||||
exclude = ('file', 'document_type')
|
exclude = ('file', 'document_type')
|
||||||
|
|
||||||
new_filename = forms.CharField(label=_(u'New document filename'), required=False)
|
|
||||||
|
|
||||||
|
|
||||||
class StagingDocumentForm(forms.Form):
|
class StagingDocumentForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -192,6 +192,7 @@ class StagingDocumentForm(forms.Form):
|
|||||||
label=_(u'Quick document rename'))
|
label=_(u'Quick document rename'))
|
||||||
|
|
||||||
staging_file_id = forms.ChoiceField(label=_(u'Staging file'))
|
staging_file_id = forms.ChoiceField(label=_(u'Staging file'))
|
||||||
|
new_filename = forms.CharField(label=_('New document filename'), required=False)
|
||||||
|
|
||||||
|
|
||||||
class DocumentTypeSelectForm(forms.Form):
|
class DocumentTypeSelectForm(forms.Form):
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ def document_create_sibling(request, document_id, multiple=True):
|
|||||||
|
|
||||||
def _handle_save_document(request, document, form=None):
|
def _handle_save_document(request, document, form=None):
|
||||||
RecentDocument.objects.add_document_for_user(request.user, document)
|
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 and 'document_type_available_filenames' in form.cleaned_data:
|
||||||
if form.cleaned_data['document_type_available_filenames']:
|
if form.cleaned_data['document_type_available_filenames']:
|
||||||
|
|||||||
Reference in New Issue
Block a user