Landing Page for internal area
This commit is contained in:
@@ -3,6 +3,7 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
from musicians.models import Musician
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
class Event ( models.Model ):
|
||||
|
||||
@@ -36,7 +37,13 @@ class Event ( models.Model ):
|
||||
for m in Musician.objects.all():
|
||||
if not m in self.participants.all():
|
||||
EventParticipation.objects.create( event=self, musician = m, status='?', comment = '' )
|
||||
|
||||
|
||||
@property
|
||||
def displaytime(self):
|
||||
if self.meeting_time is None or self.meeting_time == "":
|
||||
return self.time
|
||||
else:
|
||||
return self.meeting_time
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +63,16 @@ class EventParticipation( models.Model ):
|
||||
def get_musician_username(self):
|
||||
return self.musician.user.username
|
||||
|
||||
@staticmethod
|
||||
def hasUserSetParticipationForAllEvents( user ):
|
||||
futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() )
|
||||
maybeObjects = futurePart.filter( musician__user = user ).filter( status = '?' )
|
||||
|
||||
if len( maybeObjects ) > 0:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_or_create( musician , event ):
|
||||
|
||||
@@ -73,7 +73,6 @@ def eventplanning( request ):
|
||||
# All events in the future sorted by date
|
||||
all_future_events = list ( Event.objects.filter( date__gte = datetime.date.today() ) )
|
||||
|
||||
|
||||
musician = get_object_or_404( Musician, user=request.user )
|
||||
|
||||
for e in all_future_events:
|
||||
|
||||
Reference in New Issue
Block a user