project/scipycon/base/models.py
author Amit Sethi
Wed, 17 Nov 2010 23:25:09 +0530
changeset 236 29ecd3dd6565
parent 141 3a325a865252
permissions -rw-r--r--
Merging heads
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
diff changeset
     1
from django.db import models
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
     2
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
     3
136
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     4
class Event(models.Model):
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     5
    """Data model which holds the data related to the scope or the event.
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     6
    """
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     7
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     8
    # Different states the Event can be in
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
     9
    STATUS_CHOICES = (
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    10
        ('active', 'Active'),
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    11
        ('inactive', 'Inactive'),
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    12
    )
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    13
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    14
    # Scope of the program, used as a URL prefix
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    15
    scope = models.CharField(max_length=255)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    16
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    17
    # Name of the program
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    18
    name = models.CharField(max_length=255)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    19
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    20
    # Event specific i.e version of the event
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    21
    turn = models.CharField(max_length=255)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    22
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    23
    # Status of the program
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    24
    status = models.CharField(max_length=255, choices=STATUS_CHOICES)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    25
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    26
    def __unicode__(self):
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    27
        return '%s %s' % (self.name, self.turn)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    28
141
3a325a865252 Added get_full_name to event and used in required templates.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 136
diff changeset
    29
    def get_full_name(self):
3a325a865252 Added get_full_name to event and used in required templates.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 136
diff changeset
    30
        return self.__unicode__()
3a325a865252 Added get_full_name to event and used in required templates.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 136
diff changeset
    31
136
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    32
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    33
class Timeline(models.Model):
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    34
    """Timeline of the program
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    35
    """
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    36
136
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    37
    # Event with which this timeline is associated
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    38
    event = models.OneToOneField(Event)
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    39
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    40
    # Start of registration for the program
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    41
    registration_start = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    42
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    43
    # End of registration for the program
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    44
    registration_end = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    45
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    46
    # Start of Call for Papers
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    47
    cfp_start = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    48
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    49
    # End of Call for Papers
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    50
    cfp_end = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    51
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    52
    # Accepted papers announced
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    53
    accepted_papers_announced = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    54
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    55
    # Deadline to submit proceedings paper
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    56
    proceedings_paper_deadline = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    57
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    58
    # Start of the actual program
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    59
    event_start = models.DateTimeField(blank=True, null=True)
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    60
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    61
    # End of the actual program
124
d62d301527b3 Added null=True for all the Timeline model fields.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 116
diff changeset
    62
    event_end = models.DateTimeField(blank=True, null=True)
110
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    63
136
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    64
    def __unicode__(self):
267d9eee024b Made Timeline model to refer to Event model not vice-versa.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 124
diff changeset
    65
        return '%s %s' % (self.event.name, self.event.turn)
110
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    66
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    67
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    68
class ScopedBase(models.Model):
110
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    69
    """Base model which is in turn inherited by other models
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    70
    which needs to be scoped.
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:
diff changeset
    71
    """
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    72
110
627cd08619ee Added timeline and event models and readjusted ScopedBase model.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 104
diff changeset
    73
    # Scope of entity in which it is visible
116
5191e1134082 Moved Timeline model to the top of the file.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 110
diff changeset
    74
    scope = models.ForeignKey(Event)
104
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    75
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    76
    class Meta:
1a83a26756c3 Renamed Base Model with scope and propogated it to other models.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 101
diff changeset
    77
        abstract = True
236
29ecd3dd6565 Merging heads
Amit Sethi
parents: 141
diff changeset
    78
29ecd3dd6565 Merging heads
Amit Sethi
parents: 141
diff changeset
    79
29ecd3dd6565 Merging heads
Amit Sethi
parents: 141
diff changeset
    80
class Paid(models.Model):
29ecd3dd6565 Merging heads
Amit Sethi
parents: 141
diff changeset
    81
    event_start = models.DateTimeField(blank=True, null=True)