project/scipycon/registration/models.py
changeset 101 61fc4aa7a09a
parent 94 87e77aa18610
child 104 1a83a26756c3
equal deleted inserted replaced
100:2e17fbcee0c3 101:61fc4aa7a09a
     1 # -*- coding: utf-8 -*-
       
     2 from __future__ import absolute_import
       
     3 
       
     4 #django
       
     5 from django.db import models
     1 from django.db import models
     6 from django.contrib.auth.models import User
     2 from django.contrib.auth.models import User
       
     3 
       
     4 from project.scipycon.base import models as base_models
     7 
     5 
     8 from .utils import send_confirmation_payment_email
     6 from .utils import send_confirmation_payment_email
     9 from .utils import send_banking_fix_email
     7 from .utils import send_banking_fix_email
    10 
     8 
    11 from .labels import WIFI_CHOICES
     9 from .labels import WIFI_CHOICES
    12 from .labels import WIFI_HELP
    10 from .labels import WIFI_HELP
       
    11 
    13 
    12 
    14 SIZE_CHOICES = (
    13 SIZE_CHOICES = (
    15     ('S', 'S'),
    14     ('S', 'S'),
    16     ('M', 'M'),
    15     ('M', 'M'),
    17     ('L', 'L'),
    16     ('L', 'L'),
    18     ('XL', 'XL'),
    17     ('XL', 'XL'),
    19     )
    18     )
    20 
    19 
    21 class Wifi(models.Model):
    20 
       
    21 class Wifi(base_models.Base):
    22     """Defines wifi options at *PyCon"""
    22     """Defines wifi options at *PyCon"""
    23     user = models.ForeignKey(User)
    23     user = models.ForeignKey(User)
    24     wifi = models.CharField(max_length=50, choices=WIFI_CHOICES,
    24     wifi = models.CharField(max_length=50, choices=WIFI_CHOICES,
    25             help_text=WIFI_HELP, verbose_name="Laptop")
    25             help_text=WIFI_HELP, verbose_name="Laptop")
    26 
    26 
    27 class Registration(models.Model):
    27 
    28     """Defines registration at *PyCon"""
    28 class Registration(base_models.Model):
       
    29     """Defines registration at SciPy.in"""
       
    30 
    29     slug = models.SlugField()
    31     slug = models.SlugField()
       
    32 
    30     registrant = models.ForeignKey(User)
    33     registrant = models.ForeignKey(User)
       
    34 
    31     organisation = models.CharField(max_length=255, blank=True)
    35     organisation = models.CharField(max_length=255, blank=True)
       
    36 
    32     occupation = models.CharField(max_length=255, blank=True)
    37     occupation = models.CharField(max_length=255, blank=True)
       
    38 
    33     city = models.CharField(max_length=255, blank=True)
    39     city = models.CharField(max_length=255, blank=True)
       
    40 
    34     postcode = models.CharField(max_length=255, blank=True)
    41     postcode = models.CharField(max_length=255, blank=True)
    35 #    beverage = models.CharField(max_length=255, blank=True)
    42     
    36 #    diet = models.CharField(max_length=255, blank=True)
    43     phone_num = models.CharField(max_length=14, blank=True)
    37 #    sponsor = models.CharField(max_length=255, blank=True)
    44 
    38     tshirt = models.CharField(max_length=2, choices=SIZE_CHOICES)
    45     tshirt = models.CharField(max_length=2, choices=SIZE_CHOICES)
    39 #    party = models.BooleanField(default=False)
       
    40 #    discount = models.BooleanField(default=False)
       
    41 
    46 
    42     # scipy.in specific
       
    43     conference = models.BooleanField(default=False)
    47     conference = models.BooleanField(default=False)
    44     # scipy.in specific
    48 
    45     tutorial = models.BooleanField(default=False)
    49     tutorial = models.BooleanField(default=False)
    46     # scipy.in specific
    50 
    47     sprint = models.BooleanField(default=False)
    51     sprint = models.BooleanField(default=False)
    48 
    52 
    49 #    amount = models.IntegerField(default=0)
    53     final_conference = models.BooleanField(default=False)
       
    54 
       
    55     final_tutorial = models.BooleanField(default=False)
       
    56 
       
    57     final_sprint = models.BooleanField(default=False)
       
    58 
    50     allow_contact = models.BooleanField(default=False)
    59     allow_contact = models.BooleanField(default=False)
    51 #    payment = models.BooleanField(default=False)
    60 
    52     submitted = models.DateTimeField(auto_now_add=True)
    61     submitted = models.DateTimeField(auto_now_add=True)
       
    62 
    53     last_mod = models.DateTimeField(auto_now=True)
    63     last_mod = models.DateTimeField(auto_now=True)
    54 
    64 
    55     def __unicode__(self):
    65     def __unicode__(self):
    56         return 'Registration for user: <%s %s> %s' % (self.registrant.first_name,
    66         return 'Registration for user: <%s %s> %s' % (
    57                 self.registrant.last_name, self.registrant.email)
    67             self.registrant.first_name,
    58 
    68             self.registrant.last_name, self.registrant.email)
    59 #    def save(self, *args, **kwargs):
       
    60 #        if(self.id):
       
    61 #            old_reg = Registration.objects.get(pk=self.id)
       
    62 #            if(old_reg.payment == False and self.payment == True \
       
    63 #                    and not self.sponsor):
       
    64 #                send_confirmation_payment_email(self.registrant)
       
    65 #            if(old_reg.slug.startswith('NZ') and self.slug.startswith('KPC') \
       
    66 #                    and not self.sponsor):
       
    67 #                send_banking_fix_email(self.registrant, self.slug)
       
    68 #        super(Registration, self).save(args, kwargs)