summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwebsite/templates/cfp.html9
-rwxr-xr-xwebsite/views.py61
2 files changed, 44 insertions, 26 deletions
diff --git a/website/templates/cfp.html b/website/templates/cfp.html
index d76fbdf..373f60a 100755
--- a/website/templates/cfp.html
+++ b/website/templates/cfp.html
@@ -4,7 +4,11 @@
<html>
<head>
+ {% if user and not user.is_anonymous %}
<title>Submit Proposal</title>
+ {% else %}
+ <title>Login</title>
+ {% endif %}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
@@ -15,7 +19,12 @@
{% block header %}
<header id="header1">
<h1>SciPy India 2016</h1>
+ {% if user and not user.is_anonymous %}
<h2>Submit Proposal</h2>
+ {% else %}
+ <h2>Login</h2>
+ {% endif %}
+
</header>
{% endblock %}
diff --git a/website/views.py b/website/views.py
index 3f6a46c..3552f0a 100755
--- a/website/views.py
+++ b/website/views.py
@@ -272,33 +272,42 @@ def edit_proposal(request, proposal_id = None):
user = request.user
context = {}
if user.is_authenticated():
- proposal = Proposal.objects.get(id=proposal_id)
- if proposal.proposal_type == 'ABSTRACT':
- form = ProposalForm( instance=proposal)
- else:
- form = WorkshopForm( instance=proposal)
- if request.method == 'POST':
- if proposal.proposal_type == 'ABSTRACT':
- form = ProposalForm( request.POST, request.FILES, instance=proposal)
- else:
- form = WorkshopForm( request.POST, request.FILES, instance=proposal)
- if form.is_valid():
- data = form.save(commit = False)
- data.user = user
- proposal.status = 'Resubmitted'
- data.save()
- context.update(csrf(request))
- proposals = Proposal.objects.filter(user = user).order_by('status')
- context['proposals'] = proposals
- return render(request, 'view-abstracts.html', context)
+ try:
+ proposal = Proposal.objects.get(id=proposal_id)
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm( instance=proposal)
+ else:
+ form = WorkshopForm( instance=proposal)
else:
- context['user'] = user
- context['form'] = form
- context['proposal'] = proposal
- return render(request, 'edit-proposal.html', context)
- context['user'] = user
- context['form'] = form
- context['proposal'] = proposal
+ return render(request,'cfp.html')
+ if request.method == 'POST':
+ if proposal.status == 'Edit':
+ if proposal.proposal_type == 'ABSTRACT':
+ form = ProposalForm( request.POST, request.FILES, instance=proposal)
+ else:
+ form = WorkshopForm( request.POST, request.FILES, instance=proposal)
+ else:
+ return render(request, 'cfp.html')
+ if form.is_valid():
+ data = form.save(commit = False)
+ data.user = user
+ proposal.status = 'Resubmitted'
+ data.save()
+ context.update(csrf(request))
+ proposals = Proposal.objects.filter(user = user).order_by('status')
+ context['proposals'] = proposals
+ return render(request, 'view-abstracts.html', context)
+ else:
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ return render(request, 'edit-proposal.html', context)
+ context['user'] = user
+ context['form'] = form
+ context['proposal'] = proposal
+ except:
+ render(request, 'cfp.html')
return render(request, 'edit-proposal.html', context)
@login_required