# HG changeset patch # User Shantanu # Date 1253785830 -19800 # Node ID 7358eeae14d805c439d436e041b983f735f84482 # Parent 22e66e1ed995f63a9abd6c1181ca8d71f3beadf4 Rough website for Scipy. diff -r 22e66e1ed995 -r 7358eeae14d8 content/__init__.py diff -r 22e66e1ed995 -r 7358eeae14d8 content/forms.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/forms.py Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,63 @@ +from django import forms +from django.utils.translation import ugettext_lazy as _ +from content.models import Participant +from django.contrib.auth.models import User + +class Participantform(forms.ModelForm): + class Meta: + model = Participant + +class Registerform(forms.Form): + """ + Temporary Registration Form. + """ + PARTICIPANT_CATEGORY = ( + ('Student','Student'), + ('Corporate Staff','Corporate Staff'), + ('Teacher','Teacher'), + ('Others','Others'), + ) + username = forms.CharField(max_length=30, + label="User Name") + email = forms.EmailField(max_length=75, + label=u'Email address') + pass1 = forms.CharField(max_length=50,widget=forms.PasswordInput, + label=_("Enter New Password"), + ) + pass2 = forms.CharField(max_length=50,widget=forms.PasswordInput, + label=_("Enter New Password Again"), + ) + category = forms.ChoiceField(label=_("Category"), + choices=PARTICIPANT_CATEGORY) + organiztion = forms.CharField(max_length=200, + label=_("Organisation"), + required=False) + attending_conf = forms.BooleanField(label=_("Will you attend conference?")) + attending_tut = forms.BooleanField(label=_("Will you attend tutorial session?"), + required=False) + attending_sprint = forms.BooleanField(label=_("Will you attend sprint?"), + required=False) + + def save(self): + '''To create a user and save additional information + related to user. + ''' + profile=self.cleaned_data + new_user = User.objects.create_user(username=profile.get('username'), + password=profile.get('pass1'), + email=profile.get('email')) + participant = Participantform() + participant.username = profile.get('username') + participant.category = profile.get('category') + participant.organiztion = profile.get('organization') + participant.attending_conf = profile.get('attending_conf') + participant.attending_tut = profile.get('attending_tut') + participant.attending_sprint = profile.get('attending_sprint') + participant.save() + return new_user + +class LoginForm(forms.Form): + username = forms.CharField(max_length=30, label=_(u'username')) + password = forms.CharField(max_length=50,widget=forms.PasswordInput, + label=_("Enter New Password") + ) diff -r 22e66e1ed995 -r 7358eeae14d8 content/models.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/models.py Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,39 @@ +from django.db import models +from django.forms import ModelForm +from django.contrib.auth.models import User, UserManager + +from django.utils.translation import ugettext_lazy as _ + +from datetime import datetime + +# Create your models here. + +class Participant(models.Model): + '''model for holding details of participants + ''' + PARTICIPANT_CATEGORY = ( + ('Student','Student'), + ('Corporate Staff','Corporate Staff'), + ('Teacher','Teacher'), + ('Others','Others'), + ) + username = models.ForeignKey(User, unique=True, related_name='profile') + category = models.CharField(max_length = 80, choices=PARTICIPANT_CATEGORY,) + organisation = models.CharField(_("Organisation"),max_length=200,blank = True,null = True) + attending_conf = models.BooleanField(verbose_name="Will you attend conference?") + attending_tut = models.BooleanField(verbose_name="Will you attend tutorial session?") + attending_sprint = models.BooleanField(verbose_name="Will you attend sprint?") + paper_submission = models.BooleanField(verbose_name="Do you want to Submit paper?") + +class ParticipantForm(ModelForm): + class Meta: + model = Participant + #model = User + #fields = ['username','email','password'] + + +class Tempreg(models.Model): + username = models.CharField(_("User Name"),max_length=30,unique=True) + email = models.EmailField(_("Email Address"),unique=True) + + diff -r 22e66e1ed995 -r 7358eeae14d8 content/views.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/views.py Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,98 @@ +# Create your views here. +from django.shortcuts import render_to_response +from django.template import Context, RequestContext, loader +from django.contrib.auth.models import User +from django.http import HttpResponse, HttpResponseRedirect +from django.contrib.auth import authenticate, login +from django.utils.translation import gettext_lazy as _ +import time, datetime + +from models import * +from content.forms import * +import re + +def makemsg(username,url): + """ + Email body to be sent to user. + """ + msg = _("\ +Dear %(username)s,\n\n\ +\ +Thank you for registering with us. Please visit this url:\n\n\ +%(url)s\n\n\ +to complete the registration\n\n\ +regards\n\ +PyCon India 2009 Team\ +") %{'username': username,'url': url} + return msg + +def home_page(request, template_name='index.html'): + return render_to_response(template_name) + +def logout(request): + print request.user.username + if request.user.is_authenticated(): + print request.user.username + logout(request) + return HttpResponseRedirect('/') + +def register(request): + """ + Register function. + """ + if request.user.is_authenticated(): + msg = _("You are already registered") + return HttpResponseRedirect("/2009/message/%s/" % msg) + if request.POST: + # On POST method. + form = Registerform(request.POST) + if form.is_valid(): + # If form is clean and has no errors. + fm = form.cleaned_data + if len(fm['username']) > 30 or len(fm['username']) < 4: + # Username should be > 4 characters and less that 30 characters. + form.errors['username']=[_("User Name must be 4-30 characters long")] + else: + r = re.compile(r"[A-Za-z0-9_]") + for alph in fm['username']: + # Check if every character of the username is either an + # alphabet or numeral. + if not r.match(alph): + form.errors['username']=[_("Invalid character %s in Username") %(alph)] + if not form.errors: + test = User.objects.filter(username__iexact=fm['username']) + # Check if username already exists. + if test: + form.errors['username'] = [("Username registered, try something else")] + # Check if the email id has already been in use. + teste = User.objects.filter(email__iexact=fm['email']) + if teste: + form.errors['email'] = [_("Email registered. Try something else")] + else: + # If username is found in the temporary registration database + # then show pending error message. + teste1 = User.objects.filter(email__iexact=fm['email']) + if teste1: + form.errors['email'] = [("Username pending registration. Try tomorrow")] + if not form.errors: + # If all goes well then push into database. + new_reg = form.save() + #new_reg.save() + return HttpResponseRedirect("/regthank/%i/" % new_reg.id) + else: + # On the GET method. + form = Registerform() + return render_to_response("register.html", + {"form":form.as_table(), + }, context_instance=RequestContext(request)) + +def regthank(request,id): + """ + Function displayed after registration is successful. + """ + p = Participant.objects.get(pk=id) + t = loader.get_template("regthank.html") + c = RequestContext(request, + {"p":p, + }) + return HttpResponse(t.render(c)) diff -r 22e66e1ed995 -r 7358eeae14d8 manage.py diff -r 22e66e1ed995 -r 7358eeae14d8 participants Binary file participants has changed diff -r 22e66e1ed995 -r 7358eeae14d8 settings.py --- a/settings.py Thu Sep 17 18:52:21 2009 -0400 +++ b/settings.py Thu Sep 24 15:20:30 2009 +0530 @@ -1,16 +1,19 @@ # Django settings for scipy project. +import os + DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( + ('Shantanu Choudary', 'choudhary.shantanu@gmail.com'), # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS -DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = '' # Or path to database file if using sqlite3. +DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +DATABASE_NAME = 'participants' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. @@ -21,7 +24,7 @@ # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. -TIME_ZONE = 'America/Chicago' +TIME_ZONE = 'Asia/Kolkata' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html @@ -33,14 +36,17 @@ # to load the internationalization machinery. USE_I18N = True +AUTH_PROFILE_MODULE = 'content.model.Participant' + +ROOT_PATH = os.path.dirname(__file__) # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '' +MEDIA_ROOT = os.path.join(ROOT_PATH, 'site-content') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = '' +MEDIA_URL = '/site-content/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. @@ -63,9 +69,10 @@ 'django.contrib.auth.middleware.AuthenticationMiddleware', ) -ROOT_URLCONF = 'scipy.urls' +ROOT_URLCONF = 'scipy-in.urls' TEMPLATE_DIRS = ( + os.path.join(ROOT_PATH, 'template'), # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. @@ -76,4 +83,5 @@ 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', + 'scipy-in.content', ) diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/default.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site-content/default.css Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,372 @@ +/* +Design by Free CSS Templates +http://www.freecsstemplates.org +Released for free under a Creative Commons Attribution 2.5 License +*/ + +body { + margin: 0; + padding: 0; + background: #FFFFFF url(/site_media/images/img01.jpg) repeat-x; + text-align: justify; + font: 15px Arial, Helvetica, sans-serif; + color: #626262; +} + +form { + margin: 0; + padding: 0; +} + +input { + padding: 5px; + background: #FEFEFE url(/site_media/images/img13.gif) repeat-x; + border: 1px solid #626262; + font: normal 1em Arial, Helvetica, sans-serif; +} + +h1, h1 a, h2, h2 a, h3, h3 a { + margin: 0; + text-decoration: none; + font-family: Tahoma, Georgia, "Times New Roman", Times, serif; + font-weight: normal; + color: #444444; +} + +h1 { + letter-spacing: -1px; + font-size: 2.2em; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +h2 { + letter-spacing: -1px; + font-size: 2em; +} + +h3 { + font-size: 1em; +} + +p, ol, ul { + margin-bottom: 2em; + line-height: 200%; +} + +blockquote { + margin: 0 0 0 1.5em; + padding-left: 1em; + border-left: 5px solid #DDDDDD; +} + +a { + color: #1692B8; +} + +a:hover { + text-decoration: none; +} + +/* Header */ + +#header { + height: 60px; +} + +#logo h1, #logo p { + float: left; +} + +#logo h1 { + padding: 30px 0 0 40px; +} + +#logo p { + margin: 0; + padding: 14px 0 0 4px; + line-height: normal; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 14px; +} + +#logo a { + text-decoration: none; + color: #D0C7A6; +} + +#menu { + float: right; +} + +#menu ul { + margin: 0; + padding: 0; + list-style: none; +} + +#menu li { + display: block; + float: left; + height: 42px; +} + +#menu a { + display: block; + padding: 40px 20px 0px 20px; + text-decoration: none; + text-align: center; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + font-size: 14px; + color: #CEC5A4; +} + +#menu .last { + margin-right: 20px; +} + +#menu a:hover { + color: #FFFFFF; +} + +#menu .current_page_item { +} + +#menu .current_page_item a { +} + +/* Page */ + +#page { + padding: 40px 40px 0 40px; +} + +/* Content */ + +#content { + margin-right: 340px; +} + +.post { + margin-bottom: 2px; +} + +.post .title { + border-bottom: 1px #999999 dashed; + font-family: Tahoma, Georgia, "Times New Roman", Times, serif; +} + +.post .title h2 { + padding: 10px 10px 0 0px; + font-weight: normal; + font-size: 2.2em; +} + +.post .title p { + margin: 0; + padding: 0 0 2px 0px; + line-height: normal; + color: #BABABA; +} + +.post .title p a { + color: #BABABA; +} + +.post .entry { + padding: 5px 0px 5px 0px; +} + +.post .links { + margin: 0; + padding: 0 30px 30px 0px; +} + +.post .table td{ + margin-right: 100px; +} +.post .links a { + display: block; + float: left; + margin-right: 10px; + margin-bottom: 5px; + text-align: center; + text-decoration: none; + font-weight: bold; + color: #FFFFFF; +} + +.post .links a:hover { +} + +.post .links .more { + width: 128px; + height: 30px; + background: url(/site_media/images/img03.jpg) no-repeat left center; +} + +.post .links .comments { + width: 152px; + height: 30px; + background: url(/site_media/images/img04.jpg) no-repeat left center; +} + +/* Sidebar */ + +#sidebar { + float: right; + width: 300px; + margin-top: 30px; +} + +#sidebar ul { + margin: 0; + padding: 0; + list-style: none; +} + +#sidebar li { + margin-bottom: 10px; + background: url(/site_media/images/img10.gif) no-repeat left bottom; +} + +#sidebar li ul { + padding: 0 30px 40px 30px; +} + +#sidebar li li { + margin: 0; + padding-left: 20px; + background: url(/site_media/images/img11.gif) no-repeat 5px 50%; +} + +#sidebar h2 { + padding: 30px 30px 20px 30px; + background: url(/site_media/images/img09.gif) no-repeat; + font-weight: normal; + font-size: 1.6em; + color: #302D26; +} + + +/* Search */ + +#search { + padding: 20px 30px 40px 30px; +} + +#search input { + padding: 0px; + height: 20px; + width: auto; + background: #DFDFDF url(/site_media/images/img14.gif) repeat-x; + font-weight: bold; +} + +#search p { + margin: 0; + padding: 0; +} + +#search p.btn { + padding: 10px; +} + +#search #s { + padding: 5px; + width: 150px; + height: auto; + background: #FEFEFE url(/site_media/images/img13.gif) repeat-x; + border: 1px solid #626262; + font: normal 1em Arial, Helvetica, sans-serif; +} + +#search br { + display: none; +} + +/* Categories */ + +#sidebar #categories li { + background: url(/site_media/images/img12.gif) no-repeat left center; +} + +/* Calendar */ + +#calendar_wrap { + padding: 0 30px 40px 30px; +} + +#calendar table { + width: 100%; + text-align: center; +} + +#calendar thead { + background: #F1F1F1; +} + +#calendar tbody td { + border: 1px solid #F1F1F1; +} + +#calendar #prev { + text-align: left; +} + +#calendar #next { + text-align: right; +} + +#calendar tfoot a { + text-decoration: none; + font-weight: bold; +} + +#calendar #today { + background: #FFF3A7; + border: 1px solid #EB1400; + font-weight: bold; + color: #EB1400 +} + +/* Footer */ + +#footer { + padding: 50px 0 10px 0; + background: #757575 url(/site_media/images/img08.gif) repeat-x; +} + +#footer p { + margin-bottom: 1em; + text-align: center; + line-height: normal; + font-size: .9em; + color: #BABABA; +} + +#footer a { + padding: 0 20px; + text-decoration: none; + color: #DDDDDD; +} + +#footer a:hover { + color: #FFFFFF; +} + +#footer .rss { + background: url(/site_media/images/img18.gif) no-repeat left center; +} + +#footer .xhtml { + background: url(/site_media/images/img19.gif) no-repeat left center; +} + +#footer .css { + background: url(/site_media/images/img20.gif) no-repeat left center; +} + +#footer .legal a { + padding: 0; +} diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img01.jpg Binary file site-content/images/img01.jpg has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img02.jpg Binary file site-content/images/img02.jpg has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img03.jpg Binary file site-content/images/img03.jpg has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img04.jpg Binary file site-content/images/img04.jpg has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img05.gif Binary file site-content/images/img05.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img06.gif Binary file site-content/images/img06.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img07.gif Binary file site-content/images/img07.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img08.gif Binary file site-content/images/img08.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img09.gif Binary file site-content/images/img09.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img10.gif Binary file site-content/images/img10.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img11.gif Binary file site-content/images/img11.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img12.gif Binary file site-content/images/img12.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img13.gif Binary file site-content/images/img13.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img14.gif Binary file site-content/images/img14.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img15.gif Binary file site-content/images/img15.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img16.gif Binary file site-content/images/img16.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img17.gif Binary file site-content/images/img17.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img18.gif Binary file site-content/images/img18.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img19.gif Binary file site-content/images/img19.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/img20.gif Binary file site-content/images/img20.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 site-content/images/spacer.gif Binary file site-content/images/spacer.gif has changed diff -r 22e66e1ed995 -r 7358eeae14d8 template/homepage.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template/homepage.html Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,64 @@ +{% extends "index.html" %} +{% load i18n %} +{% block siderbar %} + +{% endblock %} +{% block centercontent %} +
+ +
+

Scipy.in is a conference providing opportunities to spread the use of +the Python programming language in the Scientific Computing community in +India. It provides a unique opportunity to interact with the "Who's who" +of the Python for Scientific Computing fraternity and learn, understand, +participate and contribute what is happening in the realms of Scientific +Computing using Python. Attendees of the conference and participants of +the sprints planned will be able to access and review the tools +available, apart from learning domain-specific applications and how the +tools apply to a plethora of application problems.
+ +One of the goals of the conference is to combine education, engineering, +and science with computing through the medium of Python and thereby +extrapolate on how powerful Scientific Computing is in various fields +and among different communities.

+ +
+
+
+
+

Theme

+
+
+

Theme for Conference talks - "Scientific Python in Action" with respect to Application and Teaching

+
+
+
+
+

Venue:

+
+
+

This conference is organized by "Free/Open source Software in Science and Engineering Education" (FOSSEE) project under the National Mission on Education (NME) through Information and Communication Technologies (ICT) jointly with SPACE-Kerala . SPACE-Kerala is helping coordinate and organize the conference.
+The conference is proposed to be held at the Technopark in Trivandrum, keeping in mind accessibility, the number of attendees and the location, among other aspects to be considered.

+
+
+
+
+

Dates

+
+
+

Its a 6-day program between December 12--17, 2009, comprising of 2 days of conference, 2 days of tutorials with 2 parallel tracks (one specifically for teachers and the other for the general +public), and 2 days of Sprints.

+ + + + + + + + +
DateActivity
Saturday, Dec. 12 2009Conference
Sunday, Dec. 13 2009Conference
Monday, Dec. 14 2009Tutorials
Tuesday, Dec. 15 2009Tutorials
Wednesday, Dec. 16 2009Sprint
Thursday, Dec. 17 2009Sprint
+
+
+{% endblock %} diff -r 22e66e1ed995 -r 7358eeae14d8 template/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template/index.html Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,95 @@ + + + +{% load i18n %} + + +{% trans "SciPy India 2009" %} + + + +{% block head %} +{% endblock %} + + +{% block body %} +{% endblock %} + + + + +
+ + + +
+ {% block centercontent %} + {% endblock %} + +
+
+ + + + + + diff -r 22e66e1ed995 -r 7358eeae14d8 template/register.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template/register.html Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,31 @@ +{% extends "index.html" %} +{% load i18n %} +{% block centercontent %} +
+

{% trans "Register" %}

+ +{% endblock %} diff -r 22e66e1ed995 -r 7358eeae14d8 template/regthank.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template/regthank.html Thu Sep 24 15:20:30 2009 +0530 @@ -0,0 +1,12 @@ +{% extends "index.html" %} +{% load i18n %} +{% block centercontent %} +

{% trans "Thank you for registering" %}

+ + {% if p %} +

{% trans "Dear" %} {{ p.username }}, +We will keep you posted regarding the latest activity.

+ {% else %} +

{% trans "something went wrong" %}

+ {% endif %} +{% endblock %} diff -r 22e66e1ed995 -r 7358eeae14d8 urls.py --- a/urls.py Thu Sep 17 18:52:21 2009 -0400 +++ b/urls.py Thu Sep 24 15:20:30 2009 +0530 @@ -1,4 +1,8 @@ from django.conf.urls.defaults import * +from django.conf import settings +from django.views.generic.simple import direct_to_template + +import os.path # Uncomment the next two lines to enable the admin: # from django.contrib import admin @@ -14,4 +18,9 @@ # Uncomment the next line to enable the admin: # (r'^admin/', include(admin.site.urls)), + url (r'^$', direct_to_template, {"template": "homepage.html"}, name="home"), + (r'^register/','content.views.register'), + (r'^logout/','content.views.logout'), + (r'^regthank/(?P\d+)/$', 'content.views.regthank'), + (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': 'site-content'}), )