diff options
Diffstat (limited to 'mediagoblin/submit')
-rw-r--r-- | mediagoblin/submit/forms.py | 5 | ||||
-rw-r--r-- | mediagoblin/submit/views.py | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py index 0a3b4e4d..e2264645 100644 --- a/mediagoblin/submit/forms.py +++ b/mediagoblin/submit/forms.py @@ -24,7 +24,7 @@ from mediagoblin.tools.licenses import licenses_as_choices def get_submit_start_form(form, **kwargs): - max_file_size = mg_globals.app_config.get('max_file_size', None) + max_file_size = kwargs.get('max_file_size') desc = None if max_file_size: desc = _('Max file size: {0} mb'.format(max_file_size)) @@ -50,6 +50,9 @@ def get_submit_start_form(form, **kwargs): _('License'), [wtforms.validators.Optional(),], choices=licenses_as_choices()) + max_file_size = wtforms.HiddenField('') + upload_limit = wtforms.HiddenField('') + uploaded = wtforms.HiddenField('') return SubmitStartForm(form, **kwargs) diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index d07065a6..3b853697 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -57,8 +57,14 @@ def submit_start(request): return redirect(request, "mediagoblin.user_pages.user_home", user=request.user.username) - submit_form = submit_forms.get_submit_start_form(request.form, - license=request.user.license_preference) + max_file_size = mg_globals.app_config.get('max_file_size', None) + + submit_form = submit_forms.get_submit_start_form( + request.form, + license=request.user.license_preference, + max_file_size=max_file_size, + upload_limit=upload_limit, + uploaded=user.uploaded) if request.method == 'POST' and submit_form.validate(): if not check_file_field(request, 'file'): @@ -108,7 +114,6 @@ def submit_start(request): error = False # Check if file size is over the limit - max_file_size = mg_globals.app_config.get('max_file_size', None) if max_file_size and file_size >= max_file_size: submit_form.file.errors.append( _(u'Sorry, the file size is too big.')) |