def season(request, id): if id == '0' and request.user.is_authenticated(): event = Season() event.programmer = Programmer.objects.get(user=request.user) event.endDate = date.today() try: year = int(request.GET['year']) month = int(request.GET['month']) if year in range(1970,2050) and month in range(1,13): event.startDate = date(year, month, 1) else: event.startDate = date.today() except: event.startDate = date.today() event.save() else: event = get_object_or_404(Season, id=id) if not request.user.is_authenticated(): if event.deleted or not event.confirmed: raise Http404 prog = Prog(type=[Film.objects, ], season=event, public=True, approved=True) return render_to_response('programming/season.html', { 'maintitle': event.title, 'event': event, 'extramessage': event.extramessage(request), 'prog': prog.byDate(), 'fillerImage': Picture.objects.get(id=789), }, context_instance=RequestContext(request) )
def volunteerProfile(request, volunteerId): volunteer = get_object_or_404(Programmer, user=volunteerId) prog = Prog(volunteer=volunteer, all=True, reverse=True) return render_to_response('organisation/volunteerProfile.html', { 'maintitle': volunteer.name, 'volunteer': volunteer, 'prog': prog.byDate(trimmed=True), }, context_instance=RequestContext(request))
def monthReport(request, year, month): cal = ssDate(year=year, month=month, size='month') prog = Prog(cal=cal, all=True) return render_to_response('organisation/report.html', { 'maintitle': cal.strftime("%B %Y"), 'cal': cal, 'prog': prog.byDate(), }, context_instance=RequestContext(request))
def volunteerProfile(request, volunteerId): volunteer = get_object_or_404(Programmer, user=volunteerId) prog = Prog(volunteer=volunteer, all=True, reverse=True) return render_to_response('organisation/volunteerProfile.html', { 'maintitle': volunteer.name, 'volunteer': volunteer, 'prog': prog.byDate(trimmed=True), }, context_instance=RequestContext(request) )
def monthReport(request, year, month): cal = ssDate(year=year, month=month, size='month') prog = Prog(cal=cal, all=True) return render_to_response('organisation/report.html', { 'maintitle': cal.strftime("%B %Y"), 'cal': cal, 'prog': prog.byDate(), }, context_instance=RequestContext(request) )
def meetingsReport(request, year=None): if year is None: year = datetime.now().year cal = ssDate(size='year', year=year) prog = Prog(cal=cal, types=[ Meeting.objects, ]) return render_to_response('organisation/meetingReport.html', { 'maintitle': 'Meetings %s' % year, 'cal': cal, 'prog': prog.byDate(trimmed=True), }, context_instance=RequestContext(request))
def meetingsReport(request, year=None): if year is None: year = datetime.now().year cal = ssDate(size='year', year=year) prog = Prog(cal=cal, types=[Meeting.objects, ]) return render_to_response('organisation/meetingReport.html', { 'maintitle': 'Meetings %s' % year, 'cal': cal, 'prog': prog.byDate(trimmed=True), }, context_instance=RequestContext(request) )
def listPeriod(request, dateObj=None, **kwargs): cal = ssDate(dateObj, **kwargs) prog = Prog(cal=cal, public=True, approved=True) return render_to_response('programming/listPeriod.html', { 'maintitle': kwargs['title'] if 'title' in kwargs else unicode(cal), 'earliertext': kwargs['earliertext'] if 'earliertext' in kwargs else 'Earlier', 'latertext': kwargs['latertext'] if 'latertext' in kwargs else 'Later', 'fillerImage': Picture.objects.get(id=789), 'cal': cal, 'prog': prog.byDate(), }, context_instance=RequestContext(request) )
def film(request, id): if id == '0' and request.user.is_authenticated(): event = Film() event.programmer = Programmer.objects.get(user=request.user) event.director = 'Unknown' event.certificate = Rating.objects.get(pk=1) event.season = None event.filmFormat = FilmFormat.objects.get(pk=1) event.startTime = time(19, 30) try: year = int(request.GET['year']) month = int(request.GET['month']) if year in range(1970,2050) and month in range(1,13): event.startDate = date(year, month, 1) else: event.startDate = date.today() except: event.startDate = date.today() event.save() else: event = get_object_or_404(Film, id=id) if not request.user.is_authenticated(): if event.deleted or not event.confirmed: raise Http404 if event.season is None: event.season = Season.objects.get(id=2) prog = None else: prog = Prog(type=[Film.objects, ], season=event.season, public=True, approved=True) prog = prog.byDate() return render_to_response('programming/film.html', { 'maintitle': event.title, 'event': event, 'extramessage': event.extramessage(request), 'prog': prog, 'fillerImage': Picture.objects.get(id=789), }, context_instance=RequestContext(request) )
def returnReport(request, year, month): cal = ssDate(year=year, month=month, size='month') prog = Prog(types=[ Film.objects, ], cal=cal) prog = prog.byDate(trimmed=True) totals = { 'newMembers': 0, 'membershipTake': Decimal('0.00'), 'normalTickets': 0, 'normalTake': Decimal('0.00'), 'concessionTickets': 0, 'concessionTake': Decimal('0.00'), 'ticketTake': Decimal('0.00'), 'totalTake': Decimal('0.00'), } for day, events in prog: for event in events: try: ret = event.boxofficereturn_set.all()[0] totals['newMembers'] += ret.newMembers totals['membershipTake'] += ret.membershipTake() totals['normalTickets'] += ret.normalTickets totals['normalTake'] += ret.normalTake() totals['concessionTickets'] += ret.concessionTickets totals['concessionTake'] += ret.concessionTake() totals['ticketTake'] += ret.ticketTake() totals['totalTake'] += ret.totalTake() except IndexError: pass return render_to_response( 'organisation/returnReport.html', { 'maintitle': 'Box Office Returns ' + cal.strftime("%B %Y"), 'cal': cal, 'prog': prog, 'totals': totals, }, context_instance=RequestContext(request))
def returnReport(request, year, month): cal = ssDate(year=year, month=month, size='month') prog = Prog(types=[Film.objects, ], cal=cal) prog = prog.byDate(trimmed=True) totals = { 'newMembers': 0, 'membershipTake': Decimal('0.00'), 'normalTickets': 0, 'normalTake': Decimal('0.00'), 'concessionTickets': 0, 'concessionTake': Decimal('0.00'), 'ticketTake': Decimal('0.00'), 'totalTake': Decimal('0.00'), } for day, events in prog: for event in events: try: ret = event.boxofficereturn_set.all()[0] totals['newMembers'] += ret.newMembers totals['membershipTake'] += ret.membershipTake() totals['normalTickets'] += ret.normalTickets totals['normalTake'] += ret.normalTake() totals['concessionTickets'] += ret.concessionTickets totals['concessionTake'] += ret.concessionTake() totals['ticketTake'] += ret.ticketTake() totals['totalTake'] += ret.totalTake() except IndexError: pass return render_to_response('organisation/returnReport.html', { 'maintitle': 'Box Office Returns ' + cal.strftime("%B %Y"), 'cal': cal, 'prog': prog, 'totals': totals, }, context_instance=RequestContext(request) )
def festival(request, id): if id == '0' and request.user.is_authenticated(): event = Festival() event.programmer = Programmer.objects.get(user=request.user) event.startDate = date.today() event.startTime = time(19, 30) event.endDate = date.today() event.endTime = time(19, 30) else: event = get_object_or_404(Festival, id=id) if not request.user.is_authenticated(): if event.deleted or not event.confirmed: raise Http404 prog = Prog(festival=event, public=True, approved=True) return render_to_response('programming/festival.html', { 'maintitle': event.title, 'event': event, 'extramessage': event.extramessage(request), 'prog': prog.byDate(), 'fillerImage': Picture.objects.get(id=789), }, context_instance=RequestContext(request) )
def items(self, cal): return [item for item in Prog(cal=cal).flat() if item.approved]