summaryrefslogtreecommitdiffstats
path: root/cal/models.py
blob: ae46f3f10d332aaea3ab62c0a59be4e03cb419f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from django.db import models
from django.contrib.auth.models import User,Group
from infopoint.agenda import *
from infopoint.agenda.models import *

import eventCalBase

class EventCalendar(models.Model):
    class Admin:
        pass

    owner = models.ForeignKey(User)
    year = models.IntegerField()
    month = models.IntegerField()

    class Meta:
        unique_together = (('owner', 'year', 'month'),)
    
    def __str__(self):
        return 'of %s for %02d/%04d' % (
                self.owner, self.month, self.year)


class Event(models.Model):
    class Admin:
        pass

    title =  models.ForeignKey(Event)
    cal  =  models.ForeignKey(EventCalendar)

    def __str__(self):
        return '%s @ %s' % (self.title, self.when)