diff options
author | hardythe1 | 2013-10-14 17:18:18 +0530 |
---|---|---|
committer | hardythe1 | 2013-10-14 17:18:18 +0530 |
commit | 299e6fd9d75e6a8f2828dde7e2c090d3a28e4226 (patch) | |
tree | 233e0e42838b333710088da96764cbd91cf4f80d /scipy/views.py | |
parent | 0235fb9fe9bd79206aa0f0c5a5e7d5a5f879130e (diff) | |
download | SciPy2013-299e6fd9d75e6a8f2828dde7e2c090d3a28e4226.tar.gz SciPy2013-299e6fd9d75e6a8f2828dde7e2c090d3a28e4226.tar.bz2 SciPy2013-299e6fd9d75e6a8f2828dde7e2c090d3a28e4226.zip |
minor CSS changes
Diffstat (limited to 'scipy/views.py')
-rw-r--r-- | scipy/views.py | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/scipy/views.py b/scipy/views.py index 61bd9b5..078923a 100644 --- a/scipy/views.py +++ b/scipy/views.py @@ -70,25 +70,27 @@ def user_profile(request): return HttpResponseRedirect('/2013/accounts/login?next=/2013/accounts/profile') # Document Upload View -@login_required def upload_document(request): - if request.method == 'POST': - form = DocumentUploadForm(request.POST, request.FILES) - if form.is_valid(): - data = form.save(commit=False) - data.user = request.user - data.verified = False - data.save() - return HttpResponseRedirect("/2013/call-for-proposals/?status=up") + if request.user.is_authenticated(): + if request.method == 'POST': + form = DocumentUploadForm(request.POST, request.FILES) + if form.is_valid(): + data = form.save(commit=False) + data.user = request.user + data.verified = False + data.save() + return HttpResponseRedirect("/2013/call-for-proposals/?status=up") + else: + context = {} + context.update(csrf(request)) + context['form'] = form + return render_to_response('upload-document.html', context) else: - context = {} - context.update(csrf(request)) - context['form'] = form - return render_to_response('upload-document.html', context) + form = DocumentUploadForm() + + context = {} + context.update(csrf(request)) + context['form'] = DocumentUploadForm() + return render_to_response('upload-document.html', context) else: - form = DocumentUploadForm() - - context = {} - context.update(csrf(request)) - context['form'] = DocumentUploadForm() - return render_to_response('upload-document.html', context) + return HttpResponseRedirect('/2013/accounts/login') |