summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkomalsheth2862016-12-02 13:03:34 +0530
committerkomalsheth2862016-12-02 13:03:34 +0530
commitd691cb070c312115393f6dd8e4ee48bf81c29b1c (patch)
treef67d5f77aab93999181d15c8e38880bf5ea4a627
parent3061288f2da0e545f1d6f32ddf3990038f194a6a (diff)
downloadSciPy2016-d691cb070c312115393f6dd8e4ee48bf81c29b1c.tar.gz
SciPy2016-d691cb070c312115393f6dd8e4ee48bf81c29b1c.tar.bz2
SciPy2016-d691cb070c312115393f6dd8e4ee48bf81c29b1c.zip
Modified Resubmt Status
-rwxr-xr-xwebsite/views.py61
1 files changed, 35 insertions, 26 deletions
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