sdi/models.py
author nishanth
Fri, 03 Sep 2010 16:33:33 +0530
branchanoop
changeset 242 6826f27064c9
parent 235 7583311884e1
permissions -rw-r--r--
fixed a bug
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     1
from django.db import models
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     2
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     3
GENDER_CHOICES = (('M', "Male"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     4
                  ("F", "Female"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     5
                 )
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
     6
29
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
     7
PYTHON_KNOWLEDGE_CHOICES = (("1", "No clue what Python is"),
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
     8
                            ("2", "I know for sure that Python is a language"),
5
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
     9
                            ("3", "Solved some basic problems using Python"),
29
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
    10
                            ("4", "Been using Python for quite some time"),
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
    11
                            ("5", "Written production level code in Python"),
5
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
    12
                           )
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
    13
29
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
    14
SAGE_KNOWLEDGE_CHOICES = (("1", "No clue what Sage is"),
74
84179d1bdc7e changed descriptions about sage.
anoop
parents: 49
diff changeset
    15
                          ("2", "I know for sure that Sage is a mathematical software"),
5
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
    16
                          ("3", "Solved some basic problems using Sage"),
29
8bee50ee3504 changed order of preferences in sdi/models.py.
anoop
parents: 19
diff changeset
    17
                          ("4", "Been using Sage for quite some time"),
74
84179d1bdc7e changed descriptions about sage.
anoop
parents: 49
diff changeset
    18
                          #("5", "Written production level code in Sage"),
5
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
    19
                         )
6c4b3796a608 created models in sdi app
nishanth
parents: 4
diff changeset
    20
34
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    21
TOPICS_CHOICES = (("1", "Cryptography"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    22
                  ("2", "Basic Algebra"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    23
                  ("3", "Calculus"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    24
                  ("4", "Arbitrary Precision Numerics"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    25
                  ("5", "Basic Plotting"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    26
                  ("6", "Number Theory"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    27
                  ("7", "Polynomials"),
514db83586f5 changed the topics choices.
anoop
parents: 29
diff changeset
    28
                  ("8", "Combinatorics and Graph Theory"),                                          
19
3932d9426c44 added the topics field in register form
nishanth
parents: 18
diff changeset
    29
                 )
3932d9426c44 added the topics field in register form
nishanth
parents: 18
diff changeset
    30
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    31
LIKELINESS_CHOICES = (('5', "Will attend at any cost"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    32
                      ('4', "Will attend most probably"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    33
                      ('3', "Unsure of attending"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    34
                      ('2', "Might not attend"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    35
                      ('1', "Will not attend"),
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    36
                     )
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    37
49
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    38
T_SHIRT_CHOICES = (("S","S"),
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    39
                   ("M","M"),
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    40
                   ("L","L"),
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    41
                   ("XL","XL"),                   
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    42
                  )
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    43
81
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    44
SPRINT_CHOICES = (("3", "Will sprint for sure"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    45
                  ("2", "May sprint"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    46
                  ("1", "Not my cup of tea"))
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    47
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    48
EVENT_ATTEND_CHOICES = (("5", "Is attending"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    49
                        ("3", "Has been selected but not confirmed participation"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    50
                        ("1", "Has registered and is willing to attend"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    51
                        ("0", "has registered but might not attend"))
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    52
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    53
WORKSHOP_ATTEND_CHOICES = (("3", "Is attending"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    54
                           ("2", "Has been selected but not confirmed participation"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    55
                           ("1", "Has requested for a workshop"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    56
                           ("0", "Does not need a workshop"))
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    57
213
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    58
ACCO_CHOICES = (("3", "Has requested but request has been rejected"),
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    59
                ("2", "Has been given accomodation"),
81
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    60
                ("1", "Has requested for accomodation"),
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    61
                ("0", "Does not need acco"))
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
    62
213
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    63
ACCO_LOCATION_CHOICES = (("2", "NITIE"),
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    64
                         ("1", "IITB Guest house"),
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    65
                         ("0", "IITB Hostel"))
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
    66
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    67
class Registrant(models.Model):
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    68
    """ A model to hold the details of registered users.
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    69
    """
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    70
6
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    71
    first_name = models.CharField(max_length=30)
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    72
    last_name =  models.CharField(max_length=30)
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    73
    email = models.EmailField()
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    74
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
49
eccfa73e136b added t-shirt size into models.
anoop
parents: 45
diff changeset
    75
    t_shirt_size = models.CharField(max_length=2, choices=T_SHIRT_CHOICES, verbose_name="T-Shirt size")
6
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    76
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    77
    profession = models.CharField(max_length=20)
19
3932d9426c44 added the topics field in register form
nishanth
parents: 18
diff changeset
    78
    affiliated_to = models.CharField(max_length=30, verbose_name="Affiliated Institution/Company")
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    79
18
7d587311a4b5 added blank in topics_interested field in models
nishanth
parents: 15
diff changeset
    80
    topics_interested = models.CharField(max_length=30, blank=True)
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    81
6
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    82
    knowledge_of_python = models.CharField(max_length=1, choices=PYTHON_KNOWLEDGE_CHOICES)
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    83
    need_for_python_workshop = models.BooleanField(verbose_name="Do you need a workshop on Python before you attend Sage Days")
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    84
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    85
    knowledge_of_sage = models.CharField(max_length=1, choices=SAGE_KNOWLEDGE_CHOICES)
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    86
    tools_used = models.TextField(help_text="Ex: Scilab, Mathematica, Matlab etc.", verbose_name="Other tools used", blank=True)
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    87
19
3932d9426c44 added the topics field in register form
nishanth
parents: 18
diff changeset
    88
    #address = models.TextField(help_text="To send DVD containing tutorials on Python if required.", blank=True)
3932d9426c44 added the topics field in register form
nishanth
parents: 18
diff changeset
    89
    address = models.TextField(blank=True)
15
1c2d2e702aee completed the register view
nishanth
parents: 12
diff changeset
    90
    phone_num = models.CharField(max_length=15, verbose_name="Phone Number", blank=True)
45
29d7d70c9273 added new fields to registrant.
nishanth
parents: 34
diff changeset
    91
    acco_required = models.BooleanField(verbose_name="Need accomodation", default=False)
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    92
45
29d7d70c9273 added new fields to registrant.
nishanth
parents: 34
diff changeset
    93
    priority_for_attending = models.CharField(max_length=1, default="3")
29d7d70c9273 added new fields to registrant.
nishanth
parents: 34
diff changeset
    94
    selected_for_attending = models.BooleanField(default=False)
29d7d70c9273 added new fields to registrant.
nishanth
parents: 34
diff changeset
    95
    
6
3b3c5f11af8e removed the required=True and added blank=True where it is required in models.py
nishanth
parents: 5
diff changeset
    96
    likeliness_of_attending = models.CharField(max_length=1, choices=LIKELINESS_CHOICES)
4
ac7eaa878437 created app named sdi which means Sage Days India
nishanth
parents:
diff changeset
    97
78
e84f56d4968e added __unicode__ to the model
nishanth
parents: 74
diff changeset
    98
    def __unicode__(self):
e84f56d4968e added __unicode__ to the model
nishanth
parents: 74
diff changeset
    99
235
7583311884e1 now name is printed properly
nishanth
parents: 233
diff changeset
   100
        return self.first_name.title() + " " + self.last_name.title()
81
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   101
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   102
class ParticipantInfo(models.Model):
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   103
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   104
    participant = models.ForeignKey(Registrant)
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   105
    has_laptop_for_sagedays = models.BooleanField(verbose_name="Will you bring your own laptop for Sage Days 25", default=False)
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   106
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   107
    sprinted_already = models.BooleanField(verbose_name="Have you participated in any kind of coding sprints", default=False)
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   108
    will_sprint = models.CharField(max_length=1, verbose_name="Will you sprint", 
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   109
                                   default='1', choices=SPRINT_CHOICES)
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   110
   
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   111
class RegistrantInfo(models.Model):
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   112
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   113
    registrant = models.ForeignKey(Registrant)
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   114
    status_of_attending_sagedays = models.CharField(max_length=1, default="0", choices=EVENT_ATTEND_CHOICES)
83
736b2945037f fixed a typo
nishanth
parents: 82
diff changeset
   115
    status_of_attending_workshop = models.CharField(max_length=1, default="0", choices=WORKSHOP_ATTEND_CHOICES)
81
8218d96eb765 added new models to store the registrant info
nishanth
parents: 78
diff changeset
   116
    status_of_accomodation = models.CharField(max_length=1, default="0", choices=ACCO_CHOICES)
82
408f2bee9abb renamed a few fields in models
nishanth
parents: 81
diff changeset
   117
    has_laptop_for_workshop = models.BooleanField(default=False)
213
ffe5ef840fde Added an extra field to RegistrantInfo Model to hold accommodation location of participants.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 174
diff changeset
   118
    acco_location = models.CharField(max_length=1, choices=ACCO_LOCATION_CHOICES, null=True)
233
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   119
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   120
class Incentives(models.Model):
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   121
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   122
    registrant = models.ForeignKey(Registrant)
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   123
    amount = models.IntegerField(default=0)
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   124
    t_shirt = models.BooleanField(default=False)
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   125
    
c5df028e4438 created another table to hold incentive info
nishanth
parents: 213
diff changeset
   126