project/scipycon/talk/models.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Wed, 14 Jul 2010 19:34:12 +0530
changeset 101 61fc4aa7a09a
parent 94 87e77aa18610
child 104 1a83a26756c3
permissions -rw-r--r--
Added base app from which all other apps inherit and made corresponding changes in other apps.
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
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
from tagging import register
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
from tagging.fields import TagField
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
from tagging.utils import parse_tag_input
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
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
     8
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
     9
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
    10
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
DURATION_CHOICES = (
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
    ('10', 'Lightning Talk (10 mins)'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
    ('20', 'Short Talk (20 mins)'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
    ('30', 'Standard Talk (30 mins)'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
    )
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
AUDIENCE_CHOICES = (
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
    ('nonprogrammers', 'non-programmer'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
    ('beginers', 'beginning programmer'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
    ('intermediate', 'intermediate programmer'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
    ('advanced', 'advanced programmer'),
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
    )
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
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
    24
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
    25
class Talk(base_models.Base):
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
    26
    """Defines talks 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
    27
    """
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
    28
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
    29
    slug = models.SlugField()
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
    30
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
    31
    speaker = models.ForeignKey(User)
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
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
    authors_bio = models.TextField()
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
    34
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
    35
    contact = models.EmailField()
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
    title = models.CharField(max_length=1024)
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
    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
    abstract = models.TextField()
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
    40
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
    41
    topic = models.CharField(max_length=255, 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
    42
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
    duration = models.CharField(max_length=3, choices=DURATION_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
    44
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
    audience = models.CharField(max_length=32, choices=AUDIENCE_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
    46
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    47
    approved = 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
    48
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    49
    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
    50
94
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    51
    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
    52
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    53
    def __unicode__(self):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    54
        return self.title
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    55
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    56
    def get_tag_list(self):
87e77aa18610 Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    57
        return parse_tag_input(self.tags)