project/scipycon/registration/models.py
author Amit Sethi
Thu, 18 Nov 2010 01:29:38 +0530
changeset 238 0149f28a4f74
parent 236 29ecd3dd6565
parent 226 53ea13a2893e
child 275 679a9cab4bf1
permissions -rw-r--r--
Merging heads
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
    )
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
    32
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    33
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
    34
    """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
    35
    """
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    36
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
    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
    38
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
    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
    40
                            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
    41
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
    42
198
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    43
class Accommodation(base_models.ScopedBase):
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    44
    """Defines accommodation information for SciPy.in
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    45
    """
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    46
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    47
    user = models.ForeignKey(User)
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    48
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    49
    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
    50
                           verbose_name="Gender",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    51
                           blank=True, null=True)
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
    accommodation_required = models.BooleanField(
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    54
        default=False, blank=True,
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    55
        verbose_name="Accommodation required",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    56
        help_text="Check if you need accommodation.")
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    57
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    58
    accommodation_days = models.IntegerField(
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    59
        default=0, blank=True,
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    60
        verbose_name="Number of days",
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    61
        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
    62
92fbbbc4c97a Added Django model for accommodation forms.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 137
diff changeset
    63
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    64
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
    65
    """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
    66
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    67
    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
    68
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    69
    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
    70
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    71
    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
    72
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    73
    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
    74
                                  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
    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
    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
    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
    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
    79
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
    80
    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
    81
137
ec6e58c639bf Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
    82
    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
    83
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
    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
    85
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    86
    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
    87
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    88
    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
    89
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
    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
    91
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
    92
    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
    93
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
    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
    95
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    96
    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
    97
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    98
    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
    99
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   100
    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
   101
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   102
    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
   103
        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
   104
            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
   105
            self.registrant.last_name, self.registrant.email)
236
29ecd3dd6565 Merging heads
Amit Sethi
parents: 137
diff changeset
   106
29ecd3dd6565 Merging heads
Amit Sethi
parents: 137
diff changeset
   107
238
0149f28a4f74 Merging heads
Amit Sethi
parents: 236 226
diff changeset
   108