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

from django.db import models
from django.contrib.auth.models import User

GENDER_CHOICES = (('M', "Male"),
                  ('F', 'Female'))

PROFESSION_CHOICES = (('S', 'Student'),
                      ('F', 'Faculty'),
                      ('P', 'Professional'))


class Profile(models.Model):
    """ A model to hold extra information about the user.
    """

    user = models.ForeignKey(User, unique=True)
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
    profession = models.CharField(max_length=1, choices=PROFESSION_CHOICES)
    affiliated_to = models.CharField(max_length=100, verbose_name="College/Company")
    interests = models.CharField(max_length=100, verbose_name="Fields of Interest", 
                                 help_text="Ex: Python, Image Processing, Bio Informatics etc.")

    activation_key = models.CharField(max_length=30, unique=True)

class Event(models.Model):
    """ A model for the workshop information.
    """

    key = models.CharField(max_length=10, unique=True)

    title = models.CharField(max_length=100)
    description = models.TextField()
    start_date = models.DateField(help_text="YYYY-MM-DD")
    stop_date = models.DateField(help_text="YYYY-MM-DD")
    attendees = models.ManyToManyField(User, related_name="%(class)s_attendees")
    organizers = models.ManyToManyField(User, related_name="%(class)s_organizers")

    feedback_open = models.BooleanField()
    quiz_open = models.BooleanField()

    def __unicode__(self):

        return self.title