Added a direct rename field to the local update and staging upload forms

This commit is contained in:
Roberto Rosario
2011-04-20 05:00:10 -04:00
parent ea25872cbc
commit 0e090798ba
2 changed files with 6 additions and 2 deletions

View File

@@ -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):

View File

@@ -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']: