Added base app from which all other apps inherit and made corresponding changes in other apps.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Wed, 14 Jul 2010 19:34:12 +0530
changeset 101 61fc4aa7a09a
parent 100 2e17fbcee0c3
child 102 68fb7911c438
Added base app from which all other apps inherit and made corresponding changes in other apps.
project/scipycon/base/__init__.py
project/scipycon/base/models.py
project/scipycon/proceedings/models.py
project/scipycon/registration/models.py
project/scipycon/talk/models.py
project/scipycon/user/models.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/scipycon/base/models.py	Wed Jul 14 19:34:12 2010 +0530
@@ -0,0 +1,8 @@
+from django.db import models
+
+
+class Base(models.Model):
+    """Base model which is in turn inherited by other models. 
+    """
+    
+    scope = models.CharField(max_length=255)
--- a/project/scipycon/proceedings/models.py	Wed Jul 14 19:17:31 2010 +0530
+++ b/project/scipycon/proceedings/models.py	Wed Jul 14 19:34:12 2010 +0530
@@ -1,11 +1,10 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
 from django.db import models
 from django.contrib.auth.models import User
 
+from project.scipycon.base import models as base_models
 
-class Paper(models.Model):
+
+class Paper(base_models.Base):
     """Data model for storing proceedings paper.
     """
 
@@ -22,7 +21,7 @@
     authors = models.ManyToManyField(User)
 
 
-class Attachments(models.Model):
+class Attachments(models.Base):
     """Stores attachments for papers.
     """
 
--- a/project/scipycon/registration/models.py	Wed Jul 14 19:17:31 2010 +0530
+++ b/project/scipycon/registration/models.py	Wed Jul 14 19:34:12 2010 +0530
@@ -1,16 +1,15 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
-#django
 from django.db import models
 from django.contrib.auth.models import User
 
+from project.scipycon.base import models as base_models
+
 from .utils import send_confirmation_payment_email
 from .utils import send_banking_fix_email
 
 from .labels import WIFI_CHOICES
 from .labels import WIFI_HELP
 
+
 SIZE_CHOICES = (
     ('S', 'S'),
     ('M', 'M'),
@@ -18,51 +17,52 @@
     ('XL', 'XL'),
     )
 
-class Wifi(models.Model):
+
+class Wifi(base_models.Base):
     """Defines wifi options at *PyCon"""
     user = models.ForeignKey(User)
     wifi = models.CharField(max_length=50, choices=WIFI_CHOICES,
             help_text=WIFI_HELP, verbose_name="Laptop")
 
-class Registration(models.Model):
-    """Defines registration at *PyCon"""
+
+class Registration(base_models.Model):
+    """Defines registration at SciPy.in"""
+
     slug = models.SlugField()
+
     registrant = models.ForeignKey(User)
+
     organisation = models.CharField(max_length=255, blank=True)
+
     occupation = models.CharField(max_length=255, blank=True)
+
     city = models.CharField(max_length=255, blank=True)
+
     postcode = models.CharField(max_length=255, blank=True)
-#    beverage = models.CharField(max_length=255, blank=True)
-#    diet = models.CharField(max_length=255, blank=True)
-#    sponsor = models.CharField(max_length=255, blank=True)
+    
+    phone_num = models.CharField(max_length=14, blank=True)
+
     tshirt = models.CharField(max_length=2, choices=SIZE_CHOICES)
-#    party = models.BooleanField(default=False)
-#    discount = models.BooleanField(default=False)
+
+    conference = models.BooleanField(default=False)
 
-    # scipy.in specific
-    conference = models.BooleanField(default=False)
-    # scipy.in specific
     tutorial = models.BooleanField(default=False)
-    # scipy.in specific
+
     sprint = models.BooleanField(default=False)
 
-#    amount = models.IntegerField(default=0)
+    final_conference = models.BooleanField(default=False)
+
+    final_tutorial = models.BooleanField(default=False)
+
+    final_sprint = models.BooleanField(default=False)
+
     allow_contact = models.BooleanField(default=False)
-#    payment = models.BooleanField(default=False)
+
     submitted = models.DateTimeField(auto_now_add=True)
+
     last_mod = models.DateTimeField(auto_now=True)
 
     def __unicode__(self):
-        return 'Registration for user: <%s %s> %s' % (self.registrant.first_name,
-                self.registrant.last_name, self.registrant.email)
-
-#    def save(self, *args, **kwargs):
-#        if(self.id):
-#            old_reg = Registration.objects.get(pk=self.id)
-#            if(old_reg.payment == False and self.payment == True \
-#                    and not self.sponsor):
-#                send_confirmation_payment_email(self.registrant)
-#            if(old_reg.slug.startswith('NZ') and self.slug.startswith('KPC') \
-#                    and not self.sponsor):
-#                send_banking_fix_email(self.registrant, self.slug)
-#        super(Registration, self).save(args, kwargs)
+        return 'Registration for user: <%s %s> %s' % (
+            self.registrant.first_name,
+            self.registrant.last_name, self.registrant.email)
--- a/project/scipycon/talk/models.py	Wed Jul 14 19:17:31 2010 +0530
+++ b/project/scipycon/talk/models.py	Wed Jul 14 19:34:12 2010 +0530
@@ -1,15 +1,13 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
-#django
 from django.db import models
 from django.contrib.auth.models import User
 
-#tagging
 from tagging import register
 from tagging.fields import TagField
 from tagging.utils import parse_tag_input
 
+from project.scipycon.base import models as base_models
+
+
 DURATION_CHOICES = (
     ('10', 'Lightning Talk (10 mins)'),
     ('20', 'Short Talk (20 mins)'),
@@ -23,51 +21,37 @@
     ('advanced', 'advanced programmer'),
     )
 
-#TOPIC_CHOICES = (
-#    ('Core Python', 'Core Python'),
-#    ('Other implementations: Jython, IronPython, PyPy, and Stackless', 'Other implementations: Jython, IronPython, PyPy, and Stackless'),
-#    ('Python libraries and extensions', 'Python libraries and extensions'),
-#    ('Python 3k', 'Python 3k'),
-#    ('Databases', 'Databases'),
-#    ('Documentation', 'Documentation'),
-#    ('GUI Programming', 'GUI Programming'),
-#    ('Game Programming', 'Game Programming'),
-#    ('Network Programming', 'Network Programming'),
-#    ('Open Source Python projects', 'Open Source Python projects'),
-#    ('Packaging Issues', 'Packaging Issues'),
-#    ('Programming Tools', 'Programming Tools'),
-#    ('Project Best Practices', 'Project Best Practices'),
-#    ('Embedding and Extending', 'Embedding and Extending'),
-#    ('Science and Maths', 'Science and Maths'),
-#    ('Web-based Systems', 'Web-based Systems'),
-#)
+
+class Talk(base_models.Base):
+    """Defines talks at SciPy.in
+    """
+
+    slug = models.SlugField()
+
+    speaker = models.ForeignKey(User)
+
+    authors_bio = models.TextField()
+
+    contact = models.EmailField()
 
-class Talk(models.Model):
-    """Defines talks at *PyCon"""
-    slug = models.SlugField()
-    speaker = models.ForeignKey(User)
-    authors_bio = models.TextField()
-    contact = models.EmailField()
     title = models.CharField(max_length=1024)
+
     abstract = models.TextField()
-#    outline = models.TextField()
-    topic = models.CharField(max_length=255, 
-                             #choices=TOPIC_CHOICES,
-                             blank=True)
-#    topic_other = models.CharField(max_length=255, blank=True)
+
+    topic = models.CharField(max_length=255, blank=True)
+
     duration = models.CharField(max_length=3, choices=DURATION_CHOICES)
+
     audience = models.CharField(max_length=32, choices=AUDIENCE_CHOICES, blank=True)
-#    audience_other = models.CharField(max_length=128, blank=True)
+
     approved = models.BooleanField(default=False)
+
     submitted = models.DateTimeField(auto_now_add=True)
+
     last_mod = models.DateTimeField(auto_now=True)
-#    tags = TagField(blank=True)
 
     def __unicode__(self):
         return self.title
 
     def get_tag_list(self):
         return parse_tag_input(self.tags)
-
-# register(Talk) # saving talk failed - see:
-# http://code.google.com/p/django-tagging/issues/detail?id=152
--- a/project/scipycon/user/models.py	Wed Jul 14 19:17:31 2010 +0530
+++ b/project/scipycon/user/models.py	Wed Jul 14 19:34:12 2010 +0530
@@ -1,19 +1,21 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
-#django
 from django.db import models
 from django.conf import settings
 from django.db.models.signals import post_save
 from django.contrib.auth.models import User
 
-class UserProfile(models.Model):
-    """
-    Extend atributes for django User
+from project.scipycon.base import models as base_models
+
+
+class UserProfile(base_models.Base):
+    """Extend atributes for django User
     """
+
     user = models.ForeignKey(User, unique=True)
+
     url = models.URLField(blank=True, verify_exists=False)
+
     photo = models.CharField(max_length=64, blank=True)
+
     about = models.TextField(blank=True)
 
     def __unicode__(self):