project/scipycon/registration/models.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Wed, 10 Nov 2010 07:02:57 +0530
branchpayments
changeset 244 5e6411f210de
parent 198 92fbbbc4c97a
child 245 6ba059b30281
permissions -rw-r--r--
Add a skeleton payment model.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
from django.db import models
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
from django.contrib.auth.models import User
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     4
from project.scipycon.base import models as base_models
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     5
117
1b68c8aa6091 Renamed and reordered the imports.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
     6
from project.scipycon.registration.labels import WIFI_CHOICES
1b68c8aa6091 Renamed and reordered the imports.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
     7
from project.scipycon.registration.labels import WIFI_HELP
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
     9
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
SIZE_CHOICES = (
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
    ('S', 'S'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
    ('M', 'M'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
    ('L', 'L'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
    ('XL', 'XL'),
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    15
    ('XXL', 'XXL'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    16
    )
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    17
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    18
OCCUPATION_CHOICES = (
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    19
    ('Education: Student', 'Education: Student'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    20
    ('Education: Faculty', 'Education: Faculty'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    21
    ('Education: Research', 'Education: Research'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    22
    ('Education: Other', 'Education: Other'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    23
    ('Corporate: Research', 'Corporate: Research'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    24
    ('Corporate: Other', 'Corporate: Other'),
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    25
    ('Other', 'Other')
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    26
    )
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
198
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    28
SEX_CHOICES = (
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    29
    ('Male', 'Male'),
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    30
    ('Female', 'Female'),
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    31
    ('Other', 'Other')
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    32
    )
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    33
244
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    34
PAYMENT_MODE_CHOICES = (
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    35
    (),
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    36
    (),
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    37
    ()
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    38
    )
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
    39
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    40
class Wifi(base_models.ScopedBase):
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    41
    """Defines wifi options at SciPy.in
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    42
    """
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    43
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    44
    user = models.ForeignKey(User)
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    45
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
    wifi = models.CharField(max_length=50, choices=WIFI_CHOICES,
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    47
                            help_text=WIFI_HELP, verbose_name="Laptop")
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    48
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    49
198
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    50
class Accommodation(base_models.ScopedBase):
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    51
    """Defines accommodation information for SciPy.in
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    52
    """
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    53
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    54
    user = models.ForeignKey(User)
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    55
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    56
    sex = models.CharField(max_length=50, choices=SEX_CHOICES,
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    57
                           verbose_name="Gender",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    58
                           blank=True, null=True)
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    59
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    60
    accommodation_required = models.BooleanField(
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    61
        default=False, blank=True,
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    62
        verbose_name="Accommodation required",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    63
        help_text="Check if you need accommodation.")
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    64
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    65
    accommodation_days = models.IntegerField(
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    66
        default=0, blank=True,
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    67
        verbose_name="Number of days",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    68
        help_text="Number of days the accommodation is required for?")
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    69
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    70
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    71
class Registration(base_models.ScopedBase):
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    72
    """Defines registration at SciPy.in"""
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    73
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    74
    slug = models.SlugField()
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    75
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    76
    registrant = models.ForeignKey(User)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    77
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    78
    organisation = models.CharField(max_length=255, blank=True)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    79
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    80
    occupation = models.CharField(max_length=255,
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    81
                                  choices=OCCUPATION_CHOICES, blank=True)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    82
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    83
    city = models.CharField(max_length=255, blank=True)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    84
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    85
    postcode = models.CharField(max_length=255, blank=True)
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    86
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    87
    phone_num = models.CharField(max_length=14, blank=True)
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    88
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    89
    tshirt = models.CharField(max_length=3, choices=SIZE_CHOICES)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    90
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    91
    conference = models.BooleanField(default=False)
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    92
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    93
    tutorial = models.BooleanField(default=False)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    94
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    95
    sprint = models.BooleanField(default=False)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    96
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    97
    final_conference = models.BooleanField(default=False)
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    98
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
    99
    final_tutorial = models.BooleanField(default=False)
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   100
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   101
    final_sprint = models.BooleanField(default=False)
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   102
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   103
    allow_contact = models.BooleanField(default=False)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   104
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   105
    submitted = models.DateTimeField(auto_now_add=True)
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   106
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   107
    last_mod = models.DateTimeField(auto_now=True)
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   108
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   109
    def __unicode__(self):
101
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   110
        return 'Registration for user: <%s %s> %s' % (
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   111
            self.registrant.first_name,
61fc4aa7a09a Added base app from which all other apps inherit and made corresponding changes in other apps.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 94
diff changeset
   112
            self.registrant.last_name, self.registrant.email)
244
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   113
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   114
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   115
class Payment(base_models.ScopedBase):
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   116
    """Defines payment information for SciPy.in registrants
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   117
    """
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   118
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   119
    user = models.ForeignKey(User)
5e6411f210de Add a skeleton payment model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 198
diff changeset
   120