reg/models.py
author nishanth
Fri, 09 Apr 2010 16:51:56 +0530
changeset 8 e2699e042129
parent 6 057498d12450
child 10 c52d170969f0
permissions -rw-r--r--
now a user can create an event if he is a staff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     1
from django.db import models
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     2
from django.contrib.auth.models import User
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     3
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     4
GENDER_CHOICES = (('M', "Male"),
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     5
                  ('F', 'Female'))
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     6
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     7
PROFESSION_CHOICES = (('S', 'Student'),
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     8
                      ('F', 'Faculty'),
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
     9
                      ('P', 'Professional'))
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    10
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    11
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    12
class Profile(models.Model):
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    13
    """ A model to hold extra information about the user.
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    14
    """
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    15
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    16
    user = models.ForeignKey(User, unique=True)
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    17
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    18
    profession = models.CharField(max_length=1, choices=PROFESSION_CHOICES)
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    19
    affiliated_to = models.CharField(max_length=100, verbose_name="College/Company")
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    20
    interests = models.CharField(max_length=100, verbose_name="Fields of Interest", 
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    21
                                 help_text="Ex: Python, Image Processing, Bio Informatics etc.")
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    22
2
c11afa8623f7 incorporated gen_key .
nishanth
parents: 1
diff changeset
    23
    activation_key = models.CharField(max_length=30, unique=True)
c11afa8623f7 incorporated gen_key .
nishanth
parents: 1
diff changeset
    24
0
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    25
class Event(models.Model):
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    26
    """ A model for the workshop information.
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    27
    """
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    28
2
c11afa8623f7 incorporated gen_key .
nishanth
parents: 1
diff changeset
    29
    key = models.CharField(max_length=10, unique=True)
c11afa8623f7 incorporated gen_key .
nishanth
parents: 1
diff changeset
    30
0
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    31
    title = models.CharField(max_length=100)
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    32
    description = models.TextField()
8
e2699e042129 now a user can create an event if he is a staff
nishanth
parents: 6
diff changeset
    33
    start_date = models.DateField(help_text="YYYY-MM-DD")
e2699e042129 now a user can create an event if he is a staff
nishanth
parents: 6
diff changeset
    34
    stop_date = models.DateField(help_text="YYYY-MM-DD")
0
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    35
    attendees = models.ManyToManyField(User, related_name="%(class)s_attendees")
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    36
    organizers = models.ManyToManyField(User, related_name="%(class)s_organizers")
30a0f9e20fd4 initial commit
nishanth
parents:
diff changeset
    37
1
18dc0362f550 app ready on django admin interface. but must take care of anonymous user case .
nishanth
parents: 0
diff changeset
    38
    feedback_open = models.BooleanField()
18dc0362f550 app ready on django admin interface. but must take care of anonymous user case .
nishanth
parents: 0
diff changeset
    39
    quiz_open = models.BooleanField()
6
057498d12450 users can now register but still there is no concept of activation e-mail .
nishanth
parents: 2
diff changeset
    40
057498d12450 users can now register but still there is no concept of activation e-mail .
nishanth
parents: 2
diff changeset
    41
    def __unicode__(self):
057498d12450 users can now register but still there is no concept of activation e-mail .
nishanth
parents: 2
diff changeset
    42
057498d12450 users can now register but still there is no concept of activation e-mail .
nishanth
parents: 2
diff changeset
    43
        return self.title