Added Laptop registration no to badge
authorAmit Sethi
Wed, 01 Dec 2010 12:14:55 +0530
changeset 324 1ad0be6866d6
parent 323 5d8dd7139b49
child 325 1255f442e4f8
Added Laptop registration no to badge
project/scipycon/registration/migrations/0001_initial.py
project/scipycon/user/views.py
--- a/project/scipycon/registration/migrations/0001_initial.py	Tue Nov 30 18:34:59 2010 +0530
+++ b/project/scipycon/registration/migrations/0001_initial.py	Wed Dec 01 12:14:55 2010 +0530
@@ -1,109 +1,118 @@
-# encoding: utf-8
-import datetime
+
 from south.db import db
-from south.v2 import SchemaMigration
 from django.db import models
+from project.scipycon.registration.models import *
 
-class Migration(SchemaMigration):
-
+class Migration:
+    
     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)),
-            ('registration_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
+            ('id', orm['registration.Wifi:id']),
+            ('scope', orm['registration.Wifi:scope']),
+            ('user', orm['registration.Wifi:user']),
+            ('wifi', orm['registration.Wifi:wifi']),
+            ('registration_id', orm['registration.Wifi:registration_id']),
         ))
         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)),
+            ('id', orm['registration.Accommodation:id']),
+            ('scope', orm['registration.Accommodation:scope']),
+            ('user', orm['registration.Accommodation:user']),
+            ('sex', orm['registration.Accommodation:sex']),
+            ('accommodation_required', orm['registration.Accommodation:accommodation_required']),
+            ('accommodation_on_1st', orm['registration.Accommodation:accommodation_on_1st']),
+            ('accommodation_on_2nd', orm['registration.Accommodation:accommodation_on_2nd']),
+            ('accommodation_on_3rd', orm['registration.Accommodation:accommodation_on_3rd']),
+            ('accommodation_on_4th', orm['registration.Accommodation:accommodation_on_4th']),
+            ('accommodation_on_5th', orm['registration.Accommodation:accommodation_on_5th']),
+            ('accommodation_on_6th', orm['registration.Accommodation:accommodation_on_6th']),
+            ('accommodation_days', orm['registration.Accommodation:accommodation_days']),
         ))
         db.send_create_signal('registration', ['Accommodation'])
-
+        
+        # Adding model 'Payment'
+        db.create_table('registration_payment', (
+            ('id', orm['registration.Payment:id']),
+            ('scope', orm['registration.Payment:scope']),
+            ('user', orm['registration.Payment:user']),
+            ('confirmed', orm['registration.Payment:confirmed']),
+            ('acco_confirmed', orm['registration.Payment:acco_confirmed']),
+            ('date_confirmed', orm['registration.Payment:date_confirmed']),
+            ('confirmed_mail', orm['registration.Payment:confirmed_mail']),
+            ('acco_confirmed_mail', orm['registration.Payment:acco_confirmed_mail']),
+            ('type', orm['registration.Payment:type']),
+            ('details', orm['registration.Payment:details']),
+        ))
+        db.send_create_signal('registration', ['Payment'])
+        
         # 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)),
+            ('id', orm['registration.Registration:id']),
+            ('scope', orm['registration.Registration:scope']),
+            ('slug', orm['registration.Registration:slug']),
+            ('registrant', orm['registration.Registration:registrant']),
+            ('organisation', orm['registration.Registration:organisation']),
+            ('occupation', orm['registration.Registration:occupation']),
+            ('city', orm['registration.Registration:city']),
+            ('postcode', orm['registration.Registration:postcode']),
+            ('phone_num', orm['registration.Registration:phone_num']),
+            ('tshirt', orm['registration.Registration:tshirt']),
+            ('conference', orm['registration.Registration:conference']),
+            ('tutorial', orm['registration.Registration:tutorial']),
+            ('sprint', orm['registration.Registration:sprint']),
+            ('final_conference', orm['registration.Registration:final_conference']),
+            ('final_tutorial', orm['registration.Registration:final_tutorial']),
+            ('final_sprint', orm['registration.Registration:final_sprint']),
+            ('allow_contact', orm['registration.Registration:allow_contact']),
+            ('submitted', orm['registration.Registration:submitted']),
+            ('last_mod', orm['registration.Registration:last_mod']),
         ))
         db.send_create_signal('registration', ['Registration'])
-
-        # Adding model 'Payment'
-        db.create_table('registration_payment', (
-            ('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'])),
-            ('confirmed', self.gf('django.db.models.fields.BooleanField')(default=False)),
-            ('type', self.gf('django.db.models.fields.CharField')(max_length=25, null=True, blank=True)),
-            ('details', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
-        ))
-        db.send_create_signal('registration', ['Payment'])
-
-
+        
+    
+    
     def backwards(self, orm):
         
         # Deleting model 'Wifi'
         db.delete_table('registration_wifi')
-
+        
         # Deleting model 'Accommodation'
         db.delete_table('registration_accommodation')
-
+        
+        # Deleting model 'Payment'
+        db.delete_table('registration_payment')
+        
         # Deleting model 'Registration'
         db.delete_table('registration_registration')
-
-        # Deleting model 'Payment'
-        db.delete_table('registration_payment')
-
-
+        
+    
+    
     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'},
+            'Meta': {'unique_together': "(('content_type', 'codename'),)"},
             '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'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
             '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'}),
@@ -111,7 +120,6 @@
             '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'}),
@@ -119,24 +127,32 @@
             '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'"},
+            'Meta': {'unique_together': "(('app_label', 'model'),)", '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'}),
+            'accommodation_on_1st': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_on_2nd': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_on_3rd': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_on_4th': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_on_5th': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_on_6th': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'accommodation_required': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
             '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.payment': {
-            'Meta': {'object_name': 'Payment'},
-            'confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'acco_confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'acco_confirmed_mail': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'confirmed_mail': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'date_confirmed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
             'details': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
             'scope': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['base.Event']"}),
@@ -144,13 +160,12 @@
             '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'}),
+            'allow_contact': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
             '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'}),
+            'conference': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'final_conference': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'final_sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'final_tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
             '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'}),
@@ -160,13 +175,12 @@
             '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'}),
+            'sprint': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
             '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'})
+            'tutorial': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
         },
         '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']"}),
@@ -174,5 +188,5 @@
             'wifi': ('django.db.models.fields.CharField', [], {'max_length': '50'})
         }
     }
-
+    
     complete_apps = ['registration']
--- a/project/scipycon/user/views.py	Tue Nov 30 18:34:59 2010 +0530
+++ b/project/scipycon/user/views.py	Wed Dec 01 12:14:55 2010 +0530
@@ -38,6 +38,7 @@
 from reportlab.pdfgen import canvas
 from reportlab.lib.units import cm
 from reportlab.platypus import  Image as reportlabImage
+from django.core.exceptions import ObjectDoesNotExist
 
 
 @login_required
@@ -338,34 +339,41 @@
     ref=5*cm
     # Draw things on the PDF. Here's where the PDF generation happens.
     # See the ReportLab documentation for the full list of functionality.
-    c.rect(ref,ref,9.45*cm,6.45*cm)
+    c.rect(ref,ref,9*cm,6*cm)
 
     im = reportlabImage("project/static/img/scipyshiny_small.png", width=1.75*cm, height=1.75*cm)
-    im.drawOn(c,(ref+0.8*cm),(ref+4.5*cm))
+    im.drawOn(c,(ref+0.8*cm),(ref+4.3*cm))
     c.setFont('Helvetica', 6)
-    c.drawString((ref+1.0*cm),(ref+4.4*cm),'scipy.in 2010') 
-    c.drawString((ref+1.1*cm),(ref+4.2*cm),'Hyderabad') 
+    c.drawString((ref+1.0*cm),(ref+4.2*cm),'scipy.in 2010') 
+    c.drawString((ref+1.1*cm),(ref+4.0*cm),'Hyderabad') 
 
-    c.setFont('Helvetica', 12)
+    c.setFont('Helvetica', 14)
     print request.user.id
     reg_obj=Registration.objects.get(registrant=request.user.id)
-
-    c.drawString((ref+5*cm),(ref+5*cm),str(reg_obj.slug)) 
+    c.drawString((ref+3.4*cm),(ref+4.9*cm),str(reg_obj.slug)) 
+    
     c.setFont('Helvetica-Bold', 14)
-    c.drawString((ref+0.6*cm),(ref+3.5*cm),str(request.user.get_full_name()))
+    c.drawString((ref+0.6*cm),(ref+3.4*cm),str(request.user.get_full_name()))
     c.setFont('Helvetica', 10)
-    c.drawString((ref+2.8*cm),(ref+2.8*cm),reg_obj.organisation)
+    c.drawString((ref+2.8*cm),(ref+2.7*cm),reg_obj.organisation)
     c.setFont('Helvetica', 10)
     try:
-        c.drawString((ref+2.8*cm),(ref+2.3*cm),reg_obj.occupation.split(':')[1])
+        c.drawString((ref+2.8*cm),(ref+2.2*cm),reg_obj.occupation.split(':')[1])
     except IndexError:
         c.drawString((ref+2.8*cm),(ref+2.3*cm),reg_obj.occupation)
         
     c.setFont('Helvetica', 10)
-    c.drawString((ref+2.8*cm),(ref+1.8*cm),reg_obj.city)
+    c.drawString((ref+2.8*cm),(ref+1.7*cm),reg_obj.city)
     c.setFont('Helvetica', 10)
-    c.drawString((ref+2.8*cm),(ref+1*cm),'Delegate')
-
+    c.drawString((ref+2.8*cm),(ref+1*cm),'Participant')
+    
+   
+    try:
+        wifi_obj=Wifi.objects.get(user=request.user.id)
+        c.setFont('Helvetica', 10)
+        c.drawString((ref+5.6*cm),(ref+0.5*cm),wifi_obj.registration_id)
+    except :
+        pass
 
     
     # Close the PDF object cleanly, and we're done.