Google calendar sync

This commit is contained in:
Martin Bauer
2014-04-18 13:43:02 +02:00
parent a85e2472f1
commit ba0cde09c1
10 changed files with 1625 additions and 25 deletions

View File

@@ -2,12 +2,14 @@ from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User, Permission
from django.db.models import Q
from datetime import datetime
from location_field.models import PlainLocationField
from django.db.models import Q
from django.dispatch import Signal
class NoNextEventException( Exception ):
def __str__(self):
@@ -113,7 +115,10 @@ class Event ( models.Model ):
return nextEvent
before_read = Signal()
class EventParticipation( models.Model ):
OPTIONS = ( ('?' , _('?' )),
('Yes', _('Yes')),
@@ -124,7 +129,8 @@ class EventParticipation( models.Model ):
user = models.ForeignKey( User, verbose_name=_("user") )
status = models.CharField ( max_length=3, choices = OPTIONS, default='?', verbose_name=_("status") )
comment = models.CharField ( max_length=64, blank=True, verbose_name=_("comment") )
def get_username(self):
return self.user.username
@@ -140,7 +146,11 @@ class EventParticipation( models.Model ):
return False
else:
return True
@staticmethod
def raiseBeforeReadSignal():
before_read.send( sender=EventParticipation )
@staticmethod
def isMember( user ):
return user.has_perm('eventplanner.member')