diff options
author | Komal Sheth | 2016-12-02 16:50:34 +0530 |
---|---|---|
committer | GitHub | 2016-12-02 16:50:34 +0530 |
commit | 122cdca077221f104041fb6ca343c056b7e9862b (patch) | |
tree | c24e8e5e7617d668bf416b6384da794290cd8768 | |
parent | e4be13b7143eea98f5c0fd1e1890b7f358e138d9 (diff) | |
parent | dd8b0f84462481146702290f1d48f3dfb4b1f37c (diff) | |
download | SciPy2016-122cdca077221f104041fb6ca343c056b7e9862b.tar.gz SciPy2016-122cdca077221f104041fb6ca343c056b7e9862b.tar.bz2 SciPy2016-122cdca077221f104041fb6ca343c056b7e9862b.zip |
Merge pull request #45 from FOSSEE/Home_page
Home page
-rwxr-xr-x | website/templates/cfp.html | 9 | ||||
-rwxr-xr-x | website/views.py | 61 |
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 |