summaryrefslogtreecommitdiff
path: root/project/kiwipycon/proceedings
diff options
context:
space:
mode:
authorMadhusudan.C.S2010-01-14 15:54:34 +0530
committerMadhusudan.C.S2010-01-14 15:54:34 +0530
commitce40ef6f8ec17314ed2979faba3635c8b8e8781f (patch)
tree7f183a93fbba992f64c702b508d617328609a7e7 /project/kiwipycon/proceedings
parent4d9cba3b295ad51bb4d747a8ec2f79128ee979fa (diff)
downloadscipycon-ce40ef6f8ec17314ed2979faba3635c8b8e8781f.tar.gz
scipycon-ce40ef6f8ec17314ed2979faba3635c8b8e8781f.tar.bz2
scipycon-ce40ef6f8ec17314ed2979faba3635c8b8e8781f.zip
Added the initial proceedings app files and enabled them in both production and development settings.
Diffstat (limited to 'project/kiwipycon/proceedings')
-rw-r--r--project/kiwipycon/proceedings/__init__.py0
-rw-r--r--project/kiwipycon/proceedings/forms.py34
-rw-r--r--project/kiwipycon/proceedings/models.py14
-rw-r--r--project/kiwipycon/proceedings/views.py93
4 files changed, 141 insertions, 0 deletions
diff --git a/project/kiwipycon/proceedings/__init__.py b/project/kiwipycon/proceedings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/kiwipycon/proceedings/__init__.py
diff --git a/project/kiwipycon/proceedings/forms.py b/project/kiwipycon/proceedings/forms.py
new file mode 100644
index 0000000..0104057
--- /dev/null
+++ b/project/kiwipycon/proceedings/forms.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+from django import forms
+
+
+class ProceedingsForm(forms.Form):
+ """Form for proceedings.
+ """
+
+ title = forms.CharField(required=True, label=u'Title',
+ widget=forms.TextInput(attrs={'size':'70'}))
+
+ abstract = forms.CharField(
+ widget=forms.Textarea(attrs={'cols': '80', 'rows': '8'}),
+ required=True, label=u'Abstract',
+ help_text=u'Upto 200 words. Content must strictly be in reSt format.')
+
+ body = forms.CharField(
+ widget=forms.Textarea(attrs={'cols': '80', 'rows': '25'}),
+ required=False, label=u'Body', help_text=u'Approximately 7 pages. '
+ 'Content must strictly be in reSt format.')
+
+ rst_file = forms.FileField(
+ required=False, label=u'reStructuredText file',
+ help_text=u'The file should contain two sections, one with a heading '
+ "'Abstract' and other with a heading 'Body'.")
+
+ self_author = forms.BooleanField(
+ required=False, label=u'Author(yourself)',
+ help_text=u'Check the field if you are one of the authors')
+
+ additional_authors = forms.CharField(
+ required=False, label=u'Additional Author(s)',
+ help_text=u'User ID of each additional author separated by comma.')
diff --git a/project/kiwipycon/proceedings/models.py b/project/kiwipycon/proceedings/models.py
new file mode 100644
index 0000000..e63dff6
--- /dev/null
+++ b/project/kiwipycon/proceedings/models.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+
+from django.db import models
+from django.contrib.auth.models import User
+
+
+class Paper(models.Model):
+ """Data model for storing proceedings paper.
+ """
+
+ title = models.CharField(max_length=200)
+ abstract = models.TextField()
+ body = models.TextField()
diff --git a/project/kiwipycon/proceedings/views.py b/project/kiwipycon/proceedings/views.py
new file mode 100644
index 0000000..3680873
--- /dev/null
+++ b/project/kiwipycon/proceedings/views.py
@@ -0,0 +1,93 @@
+# -*- coding: utf-8 -*-
+
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.forms import AuthenticationForm
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
+from project.kiwipycon.user.forms import RegisterForm
+from project.kiwipycon.proceedings.forms import ProceedingsForm
+
+
+@login_required
+def submit(request, template = 'proceedings/submit.html'):
+ """View to submit the proceedings paper.
+ """
+ user = request.user
+ if user.is_authenticated():
+ try:
+ profile = user.get_profile()
+ except:
+ profile, new = UserProfile.objects.get_or_create(user=user)
+ if new:
+ profile.save()
+ message = None
+
+ if request.method == 'POST':
+ proceedings_form = ProceedingsForm(data=request.POST)
+
+ register_form = RegisterForm(data=request.POST,
+ files=request.FILES)
+
+ if request.POST.get('action', None) == 'login':
+ login_form = AuthenticationForm(data=request.POST)
+ if login_form.is_valid():
+
+ from django.contrib.auth import login
+ login(request, login_form.get_user())
+
+ redirect_to = reverse('kiwipycon_submit_proceedings')
+ return set_message_cookie(redirect_to,
+ msg = u'You have been logged in.')
+
+ if request.POST.get('action', None) == 'register':
+ # add the new user
+ if register_form.is_valid():
+
+ user = kiwipycon_createuser(request, register_form.data)
+
+ if proceedings_form.is_valid():
+ if user.is_authenticated():
+ title = proceedings_form.data.get('title')
+
+ # Saved, ... redirect back to account
+ redirect_to = reverse('kiwipycon_account')
+ return set_message_cookie(redirect_to,
+ msg = u'Thanks, your paper has been submitted.')
+ else:
+ redirect_to = reverse('kiwipycon_submit_proceedings')
+ return set_message_cookie(redirect_to,
+ msg = u'Something is wrong here.')
+
+ else:
+ proceedings_form = ProceedingsForm()
+ register_form = RegisterForm()
+ login_form = AuthenticationForm()
+
+
+ proceedings_form = ProceedingsForm()
+ register_form = RegisterForm()
+ login_form = AuthenticationForm()
+
+ context = RequestContext(request, {
+ 'proceedings_form': proceedings_form,
+ 'register_form' : register_form,
+ 'message' : message,
+ 'login_form' : login_form
+ })
+
+ return render_to_response(template, context)
+
+
+def edit(request, id, template = 'proceedings/edit.html'):
+ """View to edit the proceedings paper.
+ """
+
+ context = RequestContext(request, {
+ 'proceedings_form': proceedings_form,
+ 'register_form' : register_form,
+ 'message' : message,
+ 'login_form' : login_form
+ })
+
+ return render_to_response(template, context)