From d691cb070c312115393f6dd8e4ee48bf81c29b1c Mon Sep 17 00:00:00 2001 From: komalsheth286 Date: Fri, 2 Dec 2016 13:03:34 +0530 Subject: Modified Resubmt Status --- website/views.py | 61 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'website') 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 -- cgit From dd8b0f84462481146702290f1d48f3dfb4b1f37c Mon Sep 17 00:00:00 2001 From: komalsheth286 Date: Fri, 2 Dec 2016 16:48:57 +0530 Subject: Login Page Modified --- website/templates/cfp.html | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'website') 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 @@
+ {% if user and not user.is_anonymous %}