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