project/scipycon/registration/models.py
changeset 94 87e77aa18610
child 101 61fc4aa7a09a
equal deleted inserted replaced
93:e86755df35da 94:87e77aa18610
       
     1 # -*- coding: utf-8 -*-
       
     2 from __future__ import absolute_import
       
     3 
       
     4 #django
       
     5 from django.db import models
       
     6 from django.contrib.auth.models import User
       
     7 
       
     8 from .utils import send_confirmation_payment_email
       
     9 from .utils import send_banking_fix_email
       
    10 
       
    11 from .labels import WIFI_CHOICES
       
    12 from .labels import WIFI_HELP
       
    13 
       
    14 SIZE_CHOICES = (
       
    15     ('S', 'S'),
       
    16     ('M', 'M'),
       
    17     ('L', 'L'),
       
    18     ('XL', 'XL'),
       
    19     )
       
    20 
       
    21 class Wifi(models.Model):
       
    22     """Defines wifi options at *PyCon"""
       
    23     user = models.ForeignKey(User)
       
    24     wifi = models.CharField(max_length=50, choices=WIFI_CHOICES,
       
    25             help_text=WIFI_HELP, verbose_name="Laptop")
       
    26 
       
    27 class Registration(models.Model):
       
    28     """Defines registration at *PyCon"""
       
    29     slug = models.SlugField()
       
    30     registrant = models.ForeignKey(User)
       
    31     organisation = models.CharField(max_length=255, blank=True)
       
    32     occupation = models.CharField(max_length=255, blank=True)
       
    33     city = models.CharField(max_length=255, blank=True)
       
    34     postcode = models.CharField(max_length=255, blank=True)
       
    35 #    beverage = models.CharField(max_length=255, blank=True)
       
    36 #    diet = models.CharField(max_length=255, blank=True)
       
    37 #    sponsor = models.CharField(max_length=255, blank=True)
       
    38     tshirt = models.CharField(max_length=2, choices=SIZE_CHOICES)
       
    39 #    party = models.BooleanField(default=False)
       
    40 #    discount = models.BooleanField(default=False)
       
    41 
       
    42     # scipy.in specific
       
    43     conference = models.BooleanField(default=False)
       
    44     # scipy.in specific
       
    45     tutorial = models.BooleanField(default=False)
       
    46     # scipy.in specific
       
    47     sprint = models.BooleanField(default=False)
       
    48 
       
    49 #    amount = models.IntegerField(default=0)
       
    50     allow_contact = models.BooleanField(default=False)
       
    51 #    payment = models.BooleanField(default=False)
       
    52     submitted = models.DateTimeField(auto_now_add=True)
       
    53     last_mod = models.DateTimeField(auto_now=True)
       
    54 
       
    55     def __unicode__(self):
       
    56         return 'Registration for user: <%s %s> %s' % (self.registrant.first_name,
       
    57                 self.registrant.last_name, self.registrant.email)
       
    58 
       
    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)