summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhardythe12015-07-03 15:09:37 +0530
committerhardythe12015-07-03 15:09:37 +0530
commit153cf2476a90847d24ef390a4edaf3088113f0b9 (patch)
tree899b5ab44cf7af4473d6505f4f821162d31e52c2
parent52c0fad52a7f3297571abd03798269e9b2bae53e (diff)
downloadSciPy2015-153cf2476a90847d24ef390a4edaf3088113f0b9.tar.gz
SciPy2015-153cf2476a90847d24ef390a4edaf3088113f0b9.tar.bz2
SciPy2015-153cf2476a90847d24ef390a4edaf3088113f0b9.zip
add CFP views
-rw-r--r--website/views.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/website/views.py b/website/views.py
index c4fdb2b..b80b9c0 100644
--- a/website/views.py
+++ b/website/views.py
@@ -7,11 +7,17 @@ from django.shortcuts import render_to_response, redirect
from django.views.decorators.csrf import csrf_exempt
from django.core.context_processors import csrf
from django.contrib.auth import authenticate, login, logout
+from django.contrib.auth.models import User
from django.contrib.admin.models import CHANGE
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
+from website.forms import ProposalForm
+from website.models import Proposal, Comments
+from social.apps.django_app.default.models import UserSocialAuth
+
+
def home(request):
context = {}
context.update(csrf(request))
@@ -35,3 +41,30 @@ def cfp(request):
'user': request.user})
return render_to_response('cfp.html',
context_instance=context)
+
+
+def submitcfp(request):
+ context = {}
+ if request.user.is_authenticated():
+ social_user = request.user
+ context.update(csrf(request))
+ django_user = User.objects.get(username=social_user)
+ context['user'] = django_user
+ if request.method == 'POST':
+ form = ProposalForm(request.POST, request.FILES)
+ if form.is_valid():
+ data = form.save(commit=False)
+ data.user = django_user
+ data.save()
+ context['proposal_submit'] = True
+ return render_to_response('cfp.html', context)
+ else:
+ context['proposal_form'] = form
+ return render_to_response('submit-cfp.html', context)
+ else:
+ form = ProposalForm()
+ context['proposal_form'] = form
+ return render_to_response('submit-cfp.html', context)
+ else:
+ context['login_required'] = True
+ return render_to_response('cfp.html', context)