Add scope as a parameter to all view functions for proceedings app.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Tue, 20 Jul 2010 19:26:21 +0530
changeset 125 2456984cecfc
parent 124 d62d301527b3
child 126 f185cb8316cf
Add scope as a parameter to all view functions for proceedings app.
project/scipycon/proceedings/admin.py
project/scipycon/proceedings/views.py
--- a/project/scipycon/proceedings/admin.py	Tue Jul 20 19:24:20 2010 +0530
+++ b/project/scipycon/proceedings/admin.py	Tue Jul 20 19:26:21 2010 +0530
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
 from django.contrib import admin
 
 from project.scipycon.proceedings.models import Paper
--- a/project/scipycon/proceedings/views.py	Tue Jul 20 19:24:20 2010 +0530
+++ b/project/scipycon/proceedings/views.py	Tue Jul 20 19:26:21 2010 +0530
@@ -1,5 +1,3 @@
-  # -*- coding: utf-8 -*-
-
 import os
 
 from django.contrib.auth import login
@@ -10,12 +8,12 @@
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 
+from project.scipycon.proceedings.booklet import mk_scipy_paper
+from project.scipycon.proceedings.forms import ProceedingsForm
 from project.scipycon.proceedings.models import Paper
 from project.scipycon.user.forms import RegisterForm
 from project.scipycon.user.models import UserProfile
 from project.scipycon.utils import set_message_cookie
-from project.scipycon.proceedings.booklet import mk_scipy_paper
-from project.scipycon.proceedings.forms import ProceedingsForm
 
 
 def handleUploadedFile(proceedings_form_data, rst_file):
@@ -37,7 +35,7 @@
 
 
 @login_required
-def submit(request, id=None, template='proceedings/submit.html'):
+def submit(request, scope, id=None, template='proceedings/submit.html'):
     """View to submit the proceedings paper.
     """
 
@@ -60,7 +58,8 @@
 
                 login(request, login_form.get_user())
 
-                redirect_to = reverse('scipycon_submit_proceedings')
+                redirect_to = reverse('scipycon_submit_proceedings',
+                                      kwargs={'scope': scope})
                 return set_message_cookie(redirect_to,
                         msg = u'You have been logged in.')
 
@@ -87,13 +86,14 @@
 
                 # Successfully saved. So get back to the edit page.
                 redirect_to = reverse('scipycon_submit_proceedings',
-                                  args=[paper.id])
+                                      args=[paper.id], kwargs={'scope': scope})
                 return set_message_cookie(
                 redirect_to, msg = u'Thanks, your paper has been submitted.')
             else:
                 # This is impossible. Something was wrong so return back
                 # to submit page
-                redirect_to = reverse('scipycon_submit_proceedings')
+                redirect_to = reverse('scipycon_submit_proceedings',
+                                      kwargs={'scope': scope})
                 return set_message_cookie(
                 redirect_to, msg = u'Something is wrong here.')          
     else:
@@ -198,6 +198,6 @@
     mk_scipy_paper.mk_abstract_preview(abstract, outfilename, attach_dir)
 
     from django.http import HttpResponse
-    return HttpResponse('Machi')
 
- 
\ No newline at end of file
+    # TODO: Return something in the repo
+    return HttpResponse('')