summaryrefslogtreecommitdiffstats
path: root/cal/models.py
blob: 9bfeca64ab3777a156f99d6818de4f5161b2a391 (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
from django.db import models
from django.contrib.auth.models import User,Group
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)