# HG changeset patch # User Madhusudan.C.S # Date 1290088631 -19800 # Node ID 451cdbc98dffe703a7c2e5974d40a692e02c9b8d # Parent 483641c2a98ab9edf7a66ce5981f83fc590ac663# Parent 2ea8af6851c90c2f57eab3ed1d2f8767ad6d8482 Make default the active branch. diff -r 483641c2a98a -r 451cdbc98dff .hgignore --- a/.hgignore Thu Nov 18 12:42:21 2010 +0530 +++ b/.hgignore Thu Nov 18 19:27:11 2010 +0530 @@ -39,4 +39,5 @@ project/static/media project/scipycon/user/*.pyc apache/* +*.db diff -r 483641c2a98a -r 451cdbc98dff buildout.cfg --- a/buildout.cfg Thu Nov 18 12:42:21 2010 +0530 +++ b/buildout.cfg Thu Nov 18 19:27:11 2010 +0530 @@ -1,5 +1,5 @@ [buildout] -parts = django tagging django-robots +parts = django tagging django-robots south eggs = Werkzeug PIL @@ -13,6 +13,7 @@ pythonpath = ${tagging:location} ${django-robots:location} + ${south:location} [tagging] recipe = infrae.subversion @@ -21,3 +22,7 @@ [django-robots] recipe = mercurialrecipe repository = http://bitbucket.org/jezdez/django-robots/ + +[south] +recipe = mercurialrecipe +repository = http://bitbucket.org/andrewgodwin/south/ diff -r 483641c2a98a -r 451cdbc98dff project/development.py --- a/project/development.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/development.py Thu Nov 18 19:27:11 2010 +0530 @@ -24,6 +24,7 @@ 'project.scipycon.talk', 'tagging', 'robots', + 'south', ) DATABASE_ENGINE = 'sqlite3' @@ -35,4 +36,3 @@ EMAIL_PORT = '1025' # print to standard output: # python -m smtpd -n -c DebuggingServer localhost:1025 - diff -r 483641c2a98a -r 451cdbc98dff project/production.py --- a/project/production.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/production.py Thu Nov 18 19:27:11 2010 +0530 @@ -23,6 +23,7 @@ 'project.scipycon.user', 'tagging', 'robots', + 'south', ) DATABASE_ENGINE = 'mysql' diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/forms.py --- a/project/scipycon/registration/forms.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/scipycon/registration/forms.py Thu Nov 18 19:27:11 2010 +0530 @@ -4,6 +4,7 @@ from project.scipycon.registration.models import SIZE_CHOICES from project.scipycon.registration.models import OCCUPATION_CHOICES from project.scipycon.registration.models import Accommodation +from project.scipycon.registration.models import Payment from project.scipycon.registration.models import Wifi @@ -61,7 +62,7 @@ id = forms.CharField(widget=forms.HiddenInput) class WifiForm(forms.ModelForm): - """PyCon wifi form + """SciPyCon wifi form """ def save(self, user, scope): @@ -71,17 +72,18 @@ wifi = Wifi(user=user, scope=scope) wifi.wifi = self.cleaned_data['wifi'] + wifi.registration_id = self.cleaned_data['registration_id'] wifi.save() return wifi class Meta: model = Wifi - fields = ('wifi',) + fields = ('wifi', 'registration_id') class AccommodationForm(forms.ModelForm): - """PyCon Accommodation form + """SciPyCon Accommodation form """ def save(self, user, scope): @@ -127,6 +129,52 @@ fields = ('accommodation_required', 'sex', 'accommodation_days') +class PaymentForm(forms.ModelForm): + """SciPyCon Payment form + """ + + paid = forms.BooleanField( + required=False, label="Amount paid", + help_text="Check this box if you have already paid the fees.") + + def save(self, user, scope): + try: + payment = Payment.objects.get(user=user, scope=scope) + except ObjectDoesNotExist: + payment = Payment(user=user, scope=scope) + + paid = self.cleaned_data['paid'] + type = self.cleaned_data['type'] + details = self.cleaned_data['details'] + + payment.type = type + payment.details = details + + payment.save() + + return payment + + def clean(self): + """Makes sure that payment form is correct, i.e. type and details + are filled in when the required fees is paid. + """ + + paid = self.cleaned_data['paid'] + type = self.cleaned_data['type'] + details = self.cleaned_data['details'] + + if paid and (not type or not details): + raise forms.ValidationError( + u"If you have already paid the fee it is mandatory to " + "fill in the type and mandatory fields.") + + return super(PaymentForm, self).clean() + + class Meta: + model = Payment + fields = ('paid', 'type', 'details') + + PC = ( ('all', 'all'), ('paid', 'paid'), diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/migrations/0001_initial.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project/scipycon/registration/migrations/0001_initial.py Thu Nov 18 19:27:11 2010 +0530 @@ -0,0 +1,153 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'Wifi' + db.create_table('registration_wifi', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('scope', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['base.Event'])), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('wifi', self.gf('django.db.models.fields.CharField')(max_length=50)), + )) + db.send_create_signal('registration', ['Wifi']) + + # Adding model 'Accommodation' + db.create_table('registration_accommodation', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('scope', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['base.Event'])), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('sex', self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True)), + ('accommodation_required', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('accommodation_days', self.gf('django.db.models.fields.IntegerField')(default=0, blank=True)), + )) + db.send_create_signal('registration', ['Accommodation']) + + # Adding model 'Registration' + db.create_table('registration_registration', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('scope', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['base.Event'])), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)), + ('registrant', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('organisation', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), + ('occupation', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), + ('city', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), + ('postcode', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), + ('phone_num', self.gf('django.db.models.fields.CharField')(max_length=14, blank=True)), + ('tshirt', self.gf('django.db.models.fields.CharField')(max_length=3)), + ('conference', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('tutorial', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('sprint', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('final_conference', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('final_tutorial', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('final_sprint', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('allow_contact', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('submitted', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + ('last_mod', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), + )) + db.send_create_signal('registration', ['Registration']) + + + def backwards(self, orm): + + # Deleting model 'Wifi' + db.delete_table('registration_wifi') + + # Deleting model 'Accommodation' + db.delete_table('registration_accommodation') + + # Deleting model 'Registration' + db.delete_table('registration_registration') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'base.event': { + 'Meta': {'object_name': 'Event'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'scope': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'turn': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'registration.accommodation': { + 'Meta': {'object_name': 'Accommodation'}, + 'accommodation_days': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}), + 'accommodation_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'sex': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'registration.registration': { + 'Meta': {'object_name': 'Registration'}, + 'allow_contact': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'conference': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_conference': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_mod': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'occupation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'organisation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'phone_num': ('django.db.models.fields.CharField', [], {'max_length': '14', 'blank': 'True'}), + 'postcode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'registrant': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submitted': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'tshirt': ('django.db.models.fields.CharField', [], {'max_length': '3'}), + 'tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'registration.wifi': { + 'Meta': {'object_name': 'Wifi'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'wifi': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + } + } + + complete_apps = ['registration'] diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/migrations/0002_auto__add_field_wifi_registration_id.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project/scipycon/registration/migrations/0002_auto__add_field_wifi_registration_id.py Thu Nov 18 19:27:11 2010 +0530 @@ -0,0 +1,107 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'Wifi.registration_id' + db.add_column('registration_wifi', 'registration_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True), keep_default=False) + + + def backwards(self, orm): + + # Deleting field 'Wifi.registration_id' + db.delete_column('registration_wifi', 'registration_id') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'base.event': { + 'Meta': {'object_name': 'Event'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'scope': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'turn': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'registration.accommodation': { + 'Meta': {'object_name': 'Accommodation'}, + 'accommodation_days': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}), + 'accommodation_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'sex': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'registration.registration': { + 'Meta': {'object_name': 'Registration'}, + 'allow_contact': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'conference': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_conference': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'final_tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_mod': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'occupation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'organisation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'phone_num': ('django.db.models.fields.CharField', [], {'max_length': '14', 'blank': 'True'}), + 'postcode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'registrant': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'submitted': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'tshirt': ('django.db.models.fields.CharField', [], {'max_length': '3'}), + 'tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'registration.wifi': { + 'Meta': {'object_name': 'Wifi'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'registration_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'wifi': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + } + } + + complete_apps = ['registration'] diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/migrations/__init__.py diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/models.py --- a/project/scipycon/registration/models.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/scipycon/registration/models.py Thu Nov 18 19:27:11 2010 +0530 @@ -30,6 +30,13 @@ ('Female', 'Female'), ) +PAYMENT_MODE_CHOICES = ( + ('Cheque', 'Cheque'), + ('Demand Draft(DD)', 'Demand Draft(DD)'), + ('Net Banking', 'Net Banking') + ) + + class Wifi(base_models.ScopedBase): """Defines wifi options at SciPy.in """ @@ -39,6 +46,17 @@ wifi = models.CharField(max_length=50, choices=WIFI_CHOICES, help_text=WIFI_HELP, verbose_name="Laptop") + registration_id = models.CharField( + max_length=255, verbose_name="Identification Number", + help_text="- Provide the serial or identification number at the " + "back of your laptop using which your laptop can be uniquely " + "identified. Ex: 8BDB8FB (Service Tag on Dell Laptops).
- " + "This is for security reasons and will be used while you enter and " + "leave the venue.
- Please don't provide the model number " + "like Dell Inspiron 1545. There may be many laptops of that model " + "and hence your laptop cannot be uniquely identified.", + blank=True, null=True) + class Accommodation(base_models.ScopedBase): """Defines accommodation information for SciPy.in @@ -105,4 +123,25 @@ self.registrant.last_name, self.registrant.email) +class Payment(base_models.ScopedBase): + """Defines payment information for SciPy.in registrants + """ + user = models.ForeignKey(User) + + confirmed = models.BooleanField( + default=False, blank=True) + + type = models.CharField(max_length=25, choices=PAYMENT_MODE_CHOICES, + verbose_name="Type", blank=True, null=True) + + details = models.CharField( + max_length=255, verbose_name="Details", + help_text="If the payment mode was cheque or DD please provide " + "the cheque or DD number and the name of the bank " + "and branch. Example: 4536234, SBI, IIT Powai, Mumbai.
" + "If the payment mode was Net Banking please provide the last four digits of the account number and the name " + "of the account holder and the bank name from which the " + "transfer was made. Example: 8804, Harish Chandra", + blank=True, null=True) diff -r 483641c2a98a -r 451cdbc98dff project/scipycon/registration/views.py --- a/project/scipycon/registration/views.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/scipycon/registration/views.py Thu Nov 18 19:27:11 2010 +0530 @@ -12,8 +12,10 @@ from project.scipycon.registration.forms import RegistrationEditForm from project.scipycon.registration.forms import RegistrationSubmitForm from project.scipycon.registration.forms import AccommodationForm +from project.scipycon.registration.forms import PaymentForm from project.scipycon.registration.forms import WifiForm from project.scipycon.registration.models import Accommodation +from project.scipycon.registration.models import Payment from project.scipycon.registration.models import Registration from project.scipycon.registration.models import Wifi from project.scipycon.registration.utils import send_confirmation @@ -59,11 +61,13 @@ reg = Registration.objects.get(pk=int(id)) wifi = Wifi.objects.get(user=reg.registrant) - # TODO: This is an ugly hack to add accommodation form - # details at later stage for SciPy.in 2010. This must be - # removed for SciPy.in 2011 - acco, created = Accommodation.objects.get_or_create(user=reg.registrant, - scope=scope_entity) + # TODO: This is an ugly hack to add accommodation and payment forms + # details at later stage for SciPy.in 2010. This must be removed for + # SciPy.in 2011 + acco, acco_created = Accommodation.objects.get_or_create( + user=reg.registrant, scope=scope_entity) + payment, payment_created = Payment.objects.get_or_create( + user=reg.registrant, scope=scope_entity) if reg.registrant != request.user: redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) @@ -77,9 +81,10 @@ registration_form = RegistrationEditForm(data=request.POST) wifi_form = WifiForm(data=request.POST) acco_form = AccommodationForm(data=request.POST) + payment_form = PaymentForm(data=request.POST) if (registration_form.is_valid() and wifi_form.is_valid() and - acco_form.is_valid()): + acco_form.is_valid() and payment_form.is_valid()): reg.organisation = registration_form.data.get('organisation') reg.occupation = registration_form.data.get('occupation') reg.city = registration_form.data.get('city') @@ -98,6 +103,7 @@ wifi = wifi_form.save(reg.registrant, reg.scope) acco = acco_form.save(reg.registrant, reg.scope) + payment = payment_form.save(reg.registrant, reg.scope) # Saved.. redirect redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) @@ -121,7 +127,8 @@ wifi_form = WifiForm(initial={ 'user': wifi.user, 'scope': wifi.scope, - 'wifi': wifi.wifi + 'wifi': wifi.wifi, + 'registration_id': wifi.registration_id }) acco_form = AccommodationForm(initial={ 'user': acco.user, @@ -130,6 +137,13 @@ 'accommodation_required': acco.accommodation_required, 'accommodation_days': acco.accommodation_days, }) + payment_form = PaymentForm(initial={ + 'user': payment.user, + 'scope': payment.scope, + 'paid': payment.type or payment.details, + 'type': payment.type, + 'details': payment.details, + }) return render_to_response( template_name, RequestContext(request, { @@ -137,7 +151,8 @@ 'registration': {'id': id}, 'registration_form': registration_form, 'wifi_form': wifi_form, - 'acco_form': acco_form})) + 'acco_form': acco_form, + 'payment_form': payment_form})) def submit_registration(request, scope, template_name='registration/submit-registration.html'): @@ -175,6 +190,7 @@ registrant_form = RegistrantForm(data=request.POST) wifi_form = WifiForm(data=request.POST) acco_form = AccommodationForm(data=request.POST) + payment_form = PaymentForm(data=request.POST) if request.POST.get('action', None) == 'login': login_form = AuthenticationForm(data=request.POST) @@ -210,7 +226,7 @@ newuser = user if (registration_form.is_valid() and newuser and wifi_form.is_valid() - and acco_form.is_valid()): + and acco_form.is_valid() and payment_form.is_valid()): allow_contact = registration_form.cleaned_data.get( 'allow_contact') and True or False conference = registration_form.cleaned_data.get( @@ -246,7 +262,10 @@ wifi = wifi_form.save(registrant, scope_entity) acco = acco_form.save(registrant, scope_entity) + payment = payment_form.save(registrant, scope_entity) + send_confirmation(registrant, scope_entity, password=passwd) + redirect_to = reverse('scipycon_registrations', kwargs={'scope': scope}) return set_message_cookie(redirect_to, @@ -258,6 +277,7 @@ registrant_form = RegistrantForm() wifi_form = WifiForm() acco_form = AccommodationForm() + payment_form = PaymentForm() login_form = AuthenticationForm() @@ -268,6 +288,7 @@ 'registrant_form' : registrant_form, 'over_reg' : reg_count >= REG_TOTAL and True or False, 'acco_form': acco_form, + 'payment_form': payment_form, 'wifi_form' : wifi_form, 'message' : message, 'login_form' : login_form @@ -282,7 +303,9 @@ if not request.user.is_staff: redirect_to = reverse('scipycon_login', kwargs={'scope': scope}) - + return set_message_cookie( + redirect_to, msg = u'You must be a staff on this website to ' + 'access this page.') q = Registration.objects.all() conf_num = q.filter(conference=True).count() @@ -295,3 +318,56 @@ 'tut_num': tut_num, 'sprint_num': sprint_num, })) + + +@login_required +def manage_payments(request, scope, + template_name='registration/manage_payments.html'): + """View that gives a form to manage payments. + """ + + if not request.user.is_superuser: + redirect_to = reverse('scipycon_login', kwargs={'scope': scope}) + return set_message_cookie( + redirect_to, msg = u'You must be an admin on this website to ' + 'access this page.') + + message = None + + scope_entity = Event.objects.get(scope=scope) + + if request.method == 'POST': + post_data = request.POST + list_user_ids = [] + for user_id_string in post_data: + id_str_list = user_id_string.split('_') + if (len(id_str_list) == 3 and id_str_list[0] == 'registrant' and + id_str_list[1] == 'id'): + id = int(id_str_list[2]) + reg_user = User.objects.get(pk=id) + + payment, created = reg_user.payment_set.get_or_create( + user=reg_user, scope=scope_entity) + + payment.confirmed = True + payment.save() + + list_user_ids.append(id) + + # This is done to unset for the confirmation for users for whom + # mistakenly confirmation was set. + # (TODO) This is a very expensive operation, any better solution + # will be appreciated. + unpaid_users = User.objects.exclude(pk__in=list_user_ids) + for user in unpaid_users: + payment, created = user.payment_set.get_or_create( + user=user, scope=scope_entity) + payment.confirmed = False + payment.save() + + registrants = Registration.objects.all() + + return render_to_response(template_name, RequestContext(request, + {'params': {'scope': scope}, + 'registrants': registrants, + })) diff -r 483641c2a98a -r 451cdbc98dff project/static/css/styles.css --- a/project/static/css/styles.css Thu Nov 18 12:42:21 2010 +0530 +++ b/project/static/css/styles.css Thu Nov 18 19:27:11 2010 +0530 @@ -583,4 +583,9 @@ color: #58585a; margin-left: 5em; text-align: justify; +} + +label.alert { + font-size: 1.2em; + color: #ff0000; } \ No newline at end of file diff -r 483641c2a98a -r 451cdbc98dff project/templates/notifications/regpaymentaccolaptop2010.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project/templates/notifications/regpaymentaccolaptop2010.html Thu Nov 18 19:27:11 2010 +0530 @@ -0,0 +1,71 @@ +Hello {{ name }}, + +The SciPy.in team is glad that you have registered for SciPy.in 2010, +to be held at International Institute of Information Technology, +Hyderabad. + +We would like to inform you that we have updated the information about +registration and accommodation fees and payment methods for the same, +on the website. Please find these details at +http://scipy.in/scipyin/2010/about/fees/ + +Due to some requests, we have decided to provide accommodation to a +limited number of out-station participants on a first-come-first-serve +basis. So, if you are an out-station participant and require +accommodation, please fill in your details and send us your fees as +early as possible. + +Your registration for the conference is not confirmed until you pay the +registration fees. If you requested for accommodation, your +accommodation can be confirmed only after we receive your accommodation +fees, based on the availability. It is not confirmed, until you receive +a confirmation mail from our side. + +Also, if you are bringing your own laptop for the conference, please +update the details of the same, in the registration form. + +To update all or any of the information indicated above, follow the +steps below: + +1. Login to your account on http://scipy.in. If you are unable to login + to your account through which you previously registered please + contact admin@scipy.in. We request you not to duplicate the + registrations. + +2. Click on "Registration" link on the left sidebar which takes you to + your registration summary page. + +3. Click on the "Edit Registration" link on that page which takes you + to your original registration form you submitted. + +4. Now you can see two new sections titled "Accommodation" and + "Payment" below the "Demographics" section. + +5. Please check the box if you need accommodation and select your + gender and number of days for which you need the accommodation. + +6. If you have already made the payment as instructed in the Fees page, + please check the "Paid" field and provide additional information + about your payment as mentioned on the registration page. Once + the payment is received you will receive a confirmation email from + the organizers. + +7. In the laptop section you will see a new field called + "Identification Number". If you are getting your own laptop select + "Yes" in the laptop dropdown field and provide us with the Serial + Number/Service Tag Number/Express Service Code of your laptop + using which your laptop can be uniquely identified. This is usually + present at the back of the laptop. Please DONOT give us the Laptop + make and model number such as "Dell Inspiron 1545". + + For example, the unique number for Dell laptops may be service tag + number like "8FRT7RDE" + +8. Submit the registration form to update the details. + +The registration and accommodation fees have to be paid as soon as +possible for us to confirm your registration for the conference. Please +note that there is a limit for the number of registrations. So Hurry! + +Thanks and regards, +Scipy Team diff -r 483641c2a98a -r 451cdbc98dff project/templates/registration/manage_payments.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project/templates/registration/manage_payments.html Thu Nov 18 19:27:11 2010 +0530 @@ -0,0 +1,47 @@ +{% extends "base.html" %} + +{% block title %}Manage Payments - {% endblock %} + +{% block content %} +

Manage Payments

+ +
+ +
+ Payment Details + + {% for registrant in registrants %} + + + + + {% endfor %} + + + +
+ + + {{ field.errors }} +
+
+ +
+
+ +
+{% endblock content %} diff -r 483641c2a98a -r 451cdbc98dff project/templates/registration/regstats.html --- a/project/templates/registration/regstats.html Thu Nov 18 12:42:21 2010 +0530 +++ b/project/templates/registration/regstats.html Thu Nov 18 19:27:11 2010 +0530 @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}Registration Statistics{% endblock %} +{% block title %}Registration Statistics - {% endblock %} {% block content %}

Registration Statistics

diff -r 483641c2a98a -r 451cdbc98dff project/templates/registration/submit-registration.html --- a/project/templates/registration/submit-registration.html Thu Nov 18 12:42:21 2010 +0530 +++ b/project/templates/registration/submit-registration.html Thu Nov 18 19:27:11 2010 +0530 @@ -19,6 +19,20 @@ $('#id_sex').removeAttr('disabled'); } }); + + if (!$('#id_paid').is(':checked')) { + $('#id_type').attr('disabled', 'disabled'); + $('#id_details').attr('disabled', 'disabled'); + } + $('#id_paid').change(function() { + if (!$('#id_paid').is(':checked')) { + $('#id_type').attr('disabled', 'disabled'); + $('#id_details').attr('disabled', 'disabled'); + } else { + $('#id_type').removeAttr('disabled'); + $('#id_details').removeAttr('disabled'); + } + }); }); @@ -147,6 +161,13 @@
+ Payment + + {{ payment_form }} +
+
+ +
Others {{ wifi_form }} diff -r 483641c2a98a -r 451cdbc98dff project/urls.py --- a/project/urls.py Thu Nov 18 12:42:21 2010 +0530 +++ b/project/urls.py Thu Nov 18 19:27:11 2010 +0530 @@ -51,8 +51,10 @@ 'submit_registration', name='scipycon_submit_registration'), url(r'^%s/edit-registration/(?P\d+)/$' % (SCOPE_ARG_PATTERN), 'edit_registration', name='scipycon_edit_registration'), - url(r'^%s/regstats/'% (SCOPE_ARG_PATTERN), + url(r'^%s/regstats/$'% (SCOPE_ARG_PATTERN), 'regstats', name="scipycon_regstats"), + url(r'^%s/manage_payments/$'% (SCOPE_ARG_PATTERN), + 'manage_payments', name="scipycon_manage_payments"), ) # Authentication and Profile diff -r 483641c2a98a -r 451cdbc98dff scripts/mails.py --- a/scripts/mails.py Thu Nov 18 12:42:21 2010 +0530 +++ b/scripts/mails.py Thu Nov 18 19:27:11 2010 +0530 @@ -53,22 +53,19 @@ from_email='admin@scipy.in') -def delegate_remainder(): - """Sends a mail to each speaker whose talk has been accepted - informing them about the their sponsorship. +def delegate_remainder(template=None): + """Sends a mail to each delegate about the template content specified. """ - regs = User.objects.all() - - template = 'notifications/reminder_mail.html' + regs = Registration.objects.all() for reg in regs: - subject = 'SciPy.in 2009: Remainder and details' + subject = 'SciPy.in 2010: Registration updates required for confirmation' message = loader.render_to_string( - template, dictionary={'name': reg.username}) + template, dictionary={'name': reg.registrant.get_full_name()}) - reg.email_user(subject=subject, message=message, - from_email='madhusudancs@gmail.com') + reg.registrant.email_user(subject=subject, message=message, + from_email='info@scipy.in') def delegate_about_event():