def get(self, request, *args, **kwargs): context = self.process_inputs(request, args, kwargs) personal_schedule = [] eval_occurrences = [] if not self.conference or not self.this_day or not self.calendar_type: return render(request, self.template, context) response = get_occurrences( labels=[self.calendar_type, self.conference.conference_slug], day=self.this_day.day) show_general_status(request, response, self.__class__.__name__) if len(response.occurrences) > 0: if request.user.is_authenticated() and hasattr( request.user, 'profile'): sched_response = get_schedule( request.user, labels=[ self.calendar_type, self.conference.conference_slug ]) personal_schedule = sched_response.schedule_items person = Person(user=request.user, public_id=request.user.profile.pk, public_class="Profile") eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None max_block_size, context[ 'occurrences'] = self.build_occurrence_display( response.occurrences, personal_schedule, eval_occurrences) grid_size = 2 if max_block_size < 6: grid_size = self.grid_map[max_block_size] context['grid_size'] = grid_size return render(request, self.template, context)
def get(self, request, *args, **kwargs): eventitem_id = kwargs['eventitem_id'] schedule_items = [] personal_schedule_items = [] eventitem_view = get_event_display_info(eventitem_id) person = None eval_occurrences = [] if request.user.is_authenticated and hasattr(request.user, 'profile'): person = Person( user=request.user, public_id=request.user.profile.pk, public_class="Profile") all_roles = [] for n, m in role_options: all_roles += [m] personal_schedule_items = get_schedule( request.user, labels=[ eventitem_view['event'].calendar_type, eventitem_view['event'].e_conference.conference_slug], roles=all_roles, ).schedule_items if eventitem_view['event'].calendar_type == "Conference": eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None for occurrence in eventitem_view['scheduled_events']: (favorite_link, volunteer_link, evaluate, highlight, vol_disable_msg) = build_icon_links( occurrence, eval_occurrences, eventitem_view['event'].calendar_type, (eventitem_view['event'].e_conference.status == "completed"), personal_schedule_items) schedule_items += [{ 'occurrence': occurrence, 'favorite_link': favorite_link, 'volunteer_link': volunteer_link, 'highlight': highlight, 'evaluate': evaluate, 'approval_needed': occurrence.approval_needed, 'vol_disable_msg': vol_disable_msg, }] template = 'gbe/scheduling/event_detail.tmpl' return render(request, template, {'eventitem': eventitem_view, 'show_tickets': True, 'tickets': eventitem_view['event'].get_tickets, 'user_id': request.user.id, 'schedule_items': schedule_items})
def get(self, request, *args, **kwargs): context = self.process_inputs(request, args, kwargs) personal_schedule = [] if not self.conference or not self.this_day: return render(request, self.template, context) response = get_occurrences( labels=["Volunteer", self.conference.conference_slug], day=self.this_day.day, max_volunteer=1) show_general_status(request, response, self.__class__.__name__) if len(response.occurrences) > 0: if request.user.is_authenticated and hasattr( request.user, 'profile'): all_roles = [] for n, m in role_options: all_roles += [m] sched_response = get_schedule( request.user, labels=["Volunteer", self.conference.conference_slug], roles=all_roles) personal_schedule = sched_response.schedule_items person = Person(user=request.user, public_id=request.user.profile.pk, public_class="Profile") eval_response = get_eval_info(person=person) context['occurrences'] = self.build_occurrence_display( response.occurrences, personal_schedule) context['col_per_hour'] = self.col_per_hour context['grid_list'] = self.make_time_range( self.start_grid_hour * 60, self.end_grid_hour * 60, int(60 / self.col_per_hour)) if self.next_day_end: # hack to roll around the clock context['grid_list'] += self.make_time_range( self.end_grid_hour * 60, (self.end_grid_hour + 1) * 60, int(60 / self.col_per_hour)) context['grid_list'] += self.make_time_range( 0, self.next_day_end * 60, int(60 / self.col_per_hour), True) context['col_fraction'] = 100.0 / len(context['grid_list']) return render(request, self.template, context)
def get(self, request, *args, **kwargs): context = self.process_inputs(request, args, kwargs) personal_schedule = [] eval_occurrences = [] if not self.conference or not self.this_day or not self.calendar_type: return render(request, self.template, context) response = get_occurrences( labels=[self.calendar_type, self.conference.conference_slug], day=self.this_day.day) show_general_status( request, response, self.__class__.__name__) if len(response.occurrences) > 0: if request.user.is_authenticated() and hasattr( request.user, 'profile'): sched_response = get_schedule( request.user, labels=[self.calendar_type, self.conference.conference_slug]) personal_schedule = sched_response.schedule_items person = Person( user=request.user, public_id=request.user.profile.pk, public_class="Profile") eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None max_block_size, context[ 'occurrences'] = self.build_occurrence_display( response.occurrences, personal_schedule, eval_occurrences) grid_size = 2 if max_block_size < 6: grid_size = self.grid_map[max_block_size] context['grid_size'] = grid_size return render(request, self.template, context)
def test_get_invisible_question(self): response = get_eval_info(visible=False) self.assertEqual(response.questions.first(), self.question)
def LandingPageView(request, profile_id=None, historical=False): historical = "historical" in request.GET.keys() standard_context = {} standard_context['events_list'] = Event.objects.all()[:5] if (profile_id): admin_profile = validate_perms(request, ('Registrar', 'Volunteer Coordinator', 'Act Coordinator', 'Class Coordinator', 'Vendor Coordinator', 'Ticketing - Admin')) viewer_profile = get_object_or_404(Profile, pk=profile_id) admin_message = "You are viewing a user's profile, not your own." else: viewer_profile = validate_profile(request, require=False) admin_message = None template = loader.get_template('gbe/landing_page.tmpl') class_to_class_name = {Act: "Act", Class: "Class", Costume: "Costume", Vendor: "Vendor", Volunteer: "Volunteer"} class_to_view_name = {Act: 'act_review', Class: 'class_review', Costume: 'costume_review', Vendor: 'vendor_review', Volunteer: 'volunteer_review'} if viewer_profile: bids_to_review = [] person = Person( user=viewer_profile.user_object, public_id=viewer_profile.pk, public_class="Profile") for bid in viewer_profile.bids_to_review(): bid_type = class_to_class_name.get(bid.__class__, "UNKNOWN") view_name = class_to_view_name.get(bid.__class__, None) url = "" if view_name: url = reverse(view_name, urlconf='gbe.urls', args=[str(bid.id)]) bids_to_review += [{'bid': bid, 'url': url, 'action': "Review", 'bid_type': bid_type}] bookings = [] for booking in get_schedule( viewer_profile.user_object).schedule_items: gbe_event = booking.event.eventitem.child() booking_item = { 'id': booking.event.pk, 'role': booking.role, 'conference': gbe_event.e_conference, 'starttime': booking.event.starttime, 'interested': get_bookings( [booking.event.pk], roles=["Interested"]).people, 'eventitem_id': gbe_event.eventitem_id, 'title': gbe_event.e_title, } if gbe_event.calendar_type == "Conference" and ( booking.role not in ("Teacher", "Performer", "Moderator")): eval_check = get_eval_info(booking.event.pk, person) if len(eval_check.questions) > 0: if len(eval_check.answers) > 0: booking_item['evaluate'] = "disabled" else: booking_item['evaluate'] = reverse( 'eval_event', args=[booking.event.pk, ], urlconf='gbe.scheduling.urls') bookings += [booking_item] context = RequestContext( request, {'profile': viewer_profile, 'historical': historical, 'alerts': viewer_profile.alerts(historical), 'standard_context': standard_context, 'personae': viewer_profile.get_personae(), 'troupes': viewer_profile.get_troupes(), 'combos': viewer_profile.get_combos(), 'acts': viewer_profile.get_acts(historical), 'shows': viewer_profile.get_shows(), 'classes': viewer_profile.is_teaching(historical), 'proposed_classes': viewer_profile.proposed_classes(historical), 'vendors': viewer_profile.vendors(historical), 'volunteering': viewer_profile.get_volunteerbids(), 'costumes': viewer_profile.get_costumebids(historical), 'review_items': bids_to_review, 'tickets': get_purchased_tickets(viewer_profile.user_object), 'acceptance_states': acceptance_states, 'admin_message': admin_message, 'bookings': bookings, }) if not historical: user_message = UserMessage.objects.get_or_create( view="LandingPageView", code="ABOUT_INTERESTED", defaults={ 'summary': "About Interested Attendees", 'description': interested_explain_msg}) context['interested_info'] = user_message[0].description else: context = RequestContext(request, {'standard_context': standard_context}) return HttpResponse(template.render(context))
def eval_view(request, occurrence_id=None): details = None reviewer = validate_perms(request, ('Class Coordinator', )) if request.GET and request.GET.get('conf_slug'): conference = get_conference_by_slug(request.GET['conf_slug']) else: conference = get_current_conference() if occurrence_id: detail_response = get_eval_info(occurrence_id=int(occurrence_id)) show_general_status(request, detail_response, "EvaluationDetailView") if detail_response.occurrences and len( detail_response.occurrences) > 0: detail_response.answers.sort( key=lambda answer: (answer.profile.profile.display_name, answer.question.order)) details = { 'occurrence': detail_response.occurrences[0], 'title': detail_response.occurrences[ 0].eventitem.event.e_title, 'description': detail_response.occurrences[ 0].eventitem.event.e_description, 'questions': detail_response.questions, 'evaluations': detail_response.answers, } response = get_eval_summary( labels=[conference.conference_slug, "Conference"]) header = ['Class', 'Teacher(s)', 'Time', '# Interested', '# Evaluations'] for question in response.questions: header += [question.question] header += ['Actions'] display_list = [] summary_view_data = {} events = Class.objects.filter(e_conference=conference) for occurrence in response.occurrences: class_event = events.get( eventitem_id=occurrence.eventitem.eventitem_id) teachers = [] interested = [] for person in occurrence.people: if person.role == "Interested": interested += [person] elif person.role in ("Teacher", "Moderator"): teachers += [Performer.objects.get(pk=person.public_id)] display_item = { 'id': occurrence.id, 'eventitem_id': class_event.eventitem_id, 'sort_start': occurrence.start_time, 'start': occurrence.start_time.strftime(DATETIME_FORMAT), 'title': class_event.e_title, 'teachers': teachers, 'interested': len(interested), 'eval_count': response.count.get(occurrence.pk, 0), 'detail_link': reverse( 'evaluation_detail', urlconf='gbe.reporting.urls', args=[occurrence.id])} display_list += [display_item] summary_view_data[int(occurrence.id)] = {} for question in response.questions: for item in response.summaries[question.pk]: summary_view_data[int(item['event'])][int(question.pk)] = item[ 'summary'] display_list.sort(key=lambda k: k['sort_start']) user_message = UserMessage.objects.get_or_create( view="InterestView", code="ABOUT_EVAL_REPORT", defaults={ 'summary': "About Evaluation Report", 'description': eval_report_explain_msg}) return render(request, 'gbe/report/evals.tmpl', {'header': header, 'classes': display_list, 'questions': response.questions, 'summaries': summary_view_data, 'conference_slugs': conference_slugs(), 'conference': conference, 'about': user_message[0].description, 'details': details})
def eval_view(request, occurrence_id=None): details = None reviewer = validate_perms(request, ('Class Coordinator', )) conference = None if request.GET and request.GET.get('conf_slug'): conference = get_conference_by_slug(request.GET['conf_slug']) if occurrence_id and not conference: detail_response = get_eval_info(occurrence_id=int(occurrence_id)) show_general_status(request, detail_response, "EvaluationDetailView") if detail_response.occurrences and len( detail_response.occurrences) > 0: detail_response.answers.sort(key=lambda answer: ( answer.profile.profile.display_name, answer.question.order)) details = { 'occurrence': detail_response.occurrences[0], 'title': detail_response.occurrences[0].eventitem.event.e_title, 'description': detail_response.occurrences[0].eventitem.event.e_description, 'questions': detail_response.questions, 'evaluations': detail_response.answers, } if not conference: conference = detail_response.occurrences[ 0].eventitem.event.e_conference if not conference: conference = get_current_conference() response = get_eval_summary( labels=[conference.conference_slug, "Conference"]) display_list = [] summary_view_data = {} events = Class.objects.filter(e_conference=conference) for occurrence in response.occurrences: class_event = events.get( eventitem_id=occurrence.eventitem.eventitem_id) teachers = [] interested = [] for person in occurrence.people: if person.role == "Interested": interested += [person] elif person.role in ("Teacher", "Moderator"): teachers += [Performer.objects.get(pk=person.public_id)] display_item = { 'id': occurrence.id, 'eventitem_id': class_event.eventitem_id, 'start': occurrence.start_time.strftime(GBE_TABLE_FORMAT), 'title': class_event.e_title, 'teachers': teachers, 'interested': len(interested), 'eval_count': response.count.get(occurrence.pk, 0), 'detail_link': reverse('evaluation_detail', urlconf='gbe.reporting.urls', args=[occurrence.id]) } display_list += [display_item] summary_view_data[int(occurrence.id)] = {} for question in response.questions: for item in response.summaries[question.pk]: summary_view_data[int(item['event'])][int( question.pk)] = item['summary'] user_message = UserMessage.objects.get_or_create( view="InterestView", code="ABOUT_EVAL_REPORT", defaults={ 'summary': "About Evaluation Report", 'description': eval_report_explain_msg }) return render( request, 'gbe/report/evals.tmpl', { 'columns': ['Class', 'Teacher(s)', 'Time', '# Interested', '# Evaluations'], 'vertical_columns': response.questions.values_list('question', flat=True), 'last_columns': ['Actions'], 'classes': display_list, 'questions': response.questions, 'summaries': summary_view_data, 'conference_slugs': conference_slugs(), 'conference': conference, 'about': user_message[0].description, 'details': details })
def get(self, request, *args, **kwargs): context = self.setup(request, args, kwargs) items = self.get_events_list_by_type() events = [] eval_occurrences = [] if request.user.is_authenticated() and hasattr(request.user, 'profile'): person = Person( user=request.user, public_id=request.user.profile.pk, public_class="Profile") eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None for item in items: scheduled_events = [] presenters = [] response = get_occurrences( foreign_event_ids=[item.eventitem_id]) for occurrence in response.occurrences: evaluate = None people_response = get_bookings([occurrence.pk]) highlight = None role = None favorite_link = reverse( 'set_favorite', args=[occurrence.pk, 'on'], urlconf='gbe.scheduling.urls') for person in people_response.people: if request.user == person.user: role = person.role highlight = person.role.lower() if person.role == "Interested": favorite_link = reverse( 'set_favorite', args=[occurrence.pk, 'off'], urlconf='gbe.scheduling.urls') else: favorite_link = "disabled" if person.role in ( "Teacher", "Moderator", "Panelist") and person.public_class != "Profile": presenter = Performer.objects.get(pk=person.public_id) if presenter not in presenters: presenters += [presenter] if self.conference.status == "completed" or ( item.calendar_type == 'Volunteer'): favorite_link = None if (self.event_type == 'Class') and ( occurrence.start_time < (datetime.now( tz=pytz.timezone('America/New_York') ) - timedelta(hours=settings.EVALUATION_WINDOW)) ) and ( role not in ("Teacher", "Performer", "Moderator") ) and ( eval_occurrences is not None): if occurrence in eval_occurrences: evaluate = "disabled" else: evaluate = reverse( 'eval_event', args=[occurrence.pk, ], urlconf='gbe.scheduling.urls') scheduled_events += [{ 'occurrence': occurrence, 'favorite_link': favorite_link, 'highlight': highlight, 'evaluate': evaluate, }] if len(presenters) == 0 and item.calendar_type == "Conference": presenters += [item.teacher] events += [{ 'eventitem': item, 'scheduled_events': scheduled_events, 'presenters': presenters, 'detail': reverse('detail_view', urlconf='gbe.scheduling.urls', args=[item.eventitem_id])}] context['events'] = events return render(request, self.template, context)
def test_get_invisible_question(self): response = get_eval_info(visible=False) self.assertEqual(response.questions.first(), self.question)
def get(self, request, *args, **kwargs): context = self.setup(request, args, kwargs) items = self.get_events_list_by_type() events = [] eval_occurrences = [] if request.user.is_authenticated() and hasattr(request.user, 'profile'): person = Person(user=request.user, public_id=request.user.profile.pk, public_class="Profile") eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None for item in items: scheduled_events = [] presenters = [] response = get_occurrences(foreign_event_ids=[item.eventitem_id]) for occurrence in response.occurrences: evaluate = None people_response = get_bookings([occurrence.pk]) highlight = None role = None favorite_link = reverse('set_favorite', args=[occurrence.pk, 'on'], urlconf='gbe.scheduling.urls') for person in people_response.people: if request.user == person.user: role = person.role highlight = person.role.lower() if person.role == "Interested": favorite_link = reverse( 'set_favorite', args=[occurrence.pk, 'off'], urlconf='gbe.scheduling.urls') else: favorite_link = "disabled" if person.role in ("Teacher", "Moderator", "Panelist" ) and person.public_class != "Profile": presenter = Performer.objects.get(pk=person.public_id) if presenter not in presenters: presenters += [presenter] if self.conference.status == "completed" or (item.calendar_type == 'Volunteer'): favorite_link = None if (self.event_type == 'Class') and ( occurrence.start_time < (datetime.now(tz=pytz.timezone('America/New_York')) - timedelta(hours=settings.EVALUATION_WINDOW))) and ( role not in ("Teacher", "Performer", "Moderator")) and (eval_occurrences is not None): if occurrence in eval_occurrences: evaluate = "disabled" else: evaluate = reverse('eval_event', args=[ occurrence.pk, ], urlconf='gbe.scheduling.urls') scheduled_events += [{ 'occurrence': occurrence, 'favorite_link': favorite_link, 'highlight': highlight, 'evaluate': evaluate, }] if len(presenters) == 0 and item.calendar_type == "Conference": presenters += [item.teacher] events += [{ 'eventitem': item, 'scheduled_events': scheduled_events, 'presenters': presenters, 'detail': reverse('detail_view', urlconf='gbe.scheduling.urls', args=[item.eventitem_id]) }] context['events'] = events return render(request, self.template, context)
def get(self, request, *args, **kwargs): eventitem_id = kwargs['eventitem_id'] schedule_items = [] personal_schedule_items = [] eventitem_view = get_event_display_info(eventitem_id) person = None if request.user.is_authenticated() and request.user.profile: person = Person( user=request.user, public_id=request.user.profile.pk, public_class="Profile") personal_schedule_items = get_schedule( request.user, labels=[ eventitem_view['event'].calendar_type, eventitem_view['event'].e_conference.conference_slug] ).schedule_items for occurrence in eventitem_view['scheduled_events']: schedule_item = { 'occurrence': occurrence, 'favorite_link': reverse( 'set_favorite', args=[occurrence.pk, 'on'], urlconf='gbe.scheduling.urls'), 'highlight': None, 'evaluate': None } if eventitem_view['event'].calendar_type == "Volunteer" or ( eventitem_view['event'].e_conference.status == "completed" ): schedule_item['favorite_link'] = None if eventitem_view['event'].calendar_type == "Conference": eval_response = get_eval_info(occurrence_id=occurrence.pk, person=person) if len(eval_response.questions) > 0: if person and len(eval_response.answers) > 0: schedule_item['evaluate'] = "disabled" else: schedule_item['evaluate'] = reverse( 'eval_event', args=[occurrence.pk, ], urlconf='gbe.scheduling.urls') for booking in personal_schedule_items: if booking.event == occurrence: schedule_item['highlight'] = booking.role.lower() if booking.role == "Interested": schedule_item['favorite_link'] = reverse( 'set_favorite', args=[occurrence.pk, 'off'], urlconf='gbe.scheduling.urls') else: schedule_item['favorite_link'] = "disabled" schedule_item['evaluate'] = None schedule_items += [schedule_item] template = 'gbe/scheduling/event_detail.tmpl' return render(request, template, {'eventitem': eventitem_view, 'show_tickets': True, 'tickets': eventitem_view['event'].get_tickets, 'user_id': request.user.id, 'schedule_items': schedule_items})
def setup_eval(self, request, occurrence_id): eval_info = get_eval_info(occurrence_id, person=self.person) redirect_now = False item = None if len(eval_info.errors) > 0: for error in eval_info.errors: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code=error.code, defaults={ 'summary': "Get Eval Error", 'description': "An error has occurred. " }) messages.error(request, user_message[0].description + error.details) redirect_now = True elif len(eval_info.warnings) > 0: for warning in eval_info.warnings: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code=warning.code, defaults={ 'summary': "Get Eval Warning", 'description': warning.details }) messages.warning(request, user_message[0].description) redirect_now = True elif len(eval_info.questions) == 0: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code="NOT_READY", defaults={ 'summary': "No Questions", 'description': not_ready_for_eval }) messages.warning(request, user_message[0].description) redirect_now = True elif len(eval_info.answers) > 0: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code="ONLY_ONE_EVAL", defaults={ 'summary': "One Eval per Attendee", 'description': one_eval_msg }) messages.warning(request, user_message[0].description) redirect_now = True else: item = Event.objects.get( eventitem_id=eval_info.occurrences[0].foreign_event_id) if verify_bought_conference(self.person.user, item.e_conference) is False: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code="NO_VALID_PURCHASE", defaults={ 'summary': "Conference not purchased by user", 'description': not_purchased_msg }) messages.error(request, user_message[0].description) redirect_now = True response = get_bookings( occurrence_ids=[eval_info.occurrences[0].pk], roles=['Teacher', 'Moderator', 'Panelist']) user_performers = self.person.user.profile.get_performers() pk_list = [] for user_perf in user_performers: pk_list += [user_perf.pk] self.presenters = [] for person in response.people: if person.public_id in pk_list: user_message = UserMessage.objects.get_or_create( view=self.__class__.__name__, code="USER_IS_PRESENTER", defaults={ 'summary': "Can't eval your own class", 'description': eval_as_presenter_error }) messages.error(request, user_message[0].description) redirect_now = True break presenter = eval( person.public_class).objects.get(pk=person.public_id) self.presenters += [{ 'presenter': presenter, 'role': person.role }] if request.GET.get('next', None): redirect_to = request.GET['next'] else: redirect_to = reverse('home', urlconf='gbe.urls') return (redirect_to, eval_info, item, redirect_now)
def get(self, request, *args, **kwargs): context = self.groundwork(request, args, kwargs) items = self.get_events_list_by_type() events = [] eval_occurrences = [] all_roles = [] personal_schedule_items = [] if request.user.is_authenticated and hasattr(request.user, 'profile'): person = Person(user=request.user, public_id=request.user.profile.pk, public_class="Profile") for n, m in role_options: all_roles += [m] personal_schedule_items = get_schedule( request.user, labels=[self.conference.conference_slug], roles=all_roles, ).schedule_items eval_response = get_eval_info(person=person) if len(eval_response.questions) > 0: eval_occurrences = eval_response.occurrences else: eval_occurrences = None for item in items: scheduled_events = [] presenters = [] response = get_occurrences(foreign_event_ids=[item.eventitem_id]) for occurrence in response.occurrences: (favorite_link, volunteer_link, evaluate, highlight, vol_disable_msg) = build_icon_links( occurrence, eval_occurrences, item.calendar_type, (self.conference.status == "completed"), personal_schedule_items) scheduled_events += [{ 'occurrence': occurrence, 'favorite_link': favorite_link, 'volunteer_link': volunteer_link, 'highlight': highlight, 'evaluate': evaluate, 'vol_disable_msg': vol_disable_msg, 'approval_needed': occurrence.approval_needed, }] people_response = get_bookings( [occurrence.pk], roles=["Teacher", "Moderator", "Panelist"]) for person in people_response.people: if person.public_class != "Profile": presenter = Performer.objects.get(pk=person.public_id) if presenter not in presenters: presenters += [presenter] if len(presenters) == 0 and item.calendar_type == "Conference": presenters += [item.teacher] events += [{ 'eventitem': item, 'scheduled_events': scheduled_events, 'presenters': presenters, 'detail': reverse('detail_view', urlconf='gbe.scheduling.urls', args=[item.eventitem_id]) }] context['events'] = events return render(request, self.template, context)
def get(self, request, *args, **kwargs): self.groundwork(request, args, kwargs) viewer_profile = self.viewer_profile context = {} bids_to_review = [] person = Person(user=viewer_profile.user_object, public_id=viewer_profile.pk, public_class="Profile") for bid in viewer_profile.bids_to_review(): bids_to_review += [{ 'bid': bid, 'url': reverse('%s_review' % bid.__class__.__name__.lower(), urlconf='gbe.urls', args=[str(bid.id)]), 'action': "Review", 'bid_type': bid.__class__.__name__ }] personae, troupes = viewer_profile.get_performers(organize=True) bookings = [] booking_ids = [] manage_shows = [] shows = [] classes = [] acts = Act.objects.filter( Q(performer__in=personae) | Q(performer__in=troupes)) for booking in get_schedule(viewer_profile.user_object).schedule_items: gbe_event = booking.event.eventitem.child() booking_item = { 'id': booking.event.pk, 'role': booking.role, 'conference': gbe_event.e_conference, 'starttime': booking.event.starttime, 'interested': get_bookings([booking.event.pk], roles=["Interested"]).people, 'eventitem_id': gbe_event.eventitem_id, 'title': gbe_event.e_title, } if gbe_event.calendar_type == "Conference" and ( booking.role not in ("Teacher", "Performer", "Moderator")): eval_check = get_eval_info(booking.event.pk, person) if len(eval_check.questions) > 0: if len(eval_check.answers) > 0: booking_item['evaluate'] = "disabled" else: booking_item['evaluate'] = reverse( 'eval_event', args=[ booking.event.pk, ], urlconf='gbe.scheduling.urls') elif gbe_event.calendar_type == "Conference": classes += [booking_item] if gbe_event.e_conference.status != "completed": if gbe_event.calendar_type == "General" and (booking.commitment is not None): shows += [(gbe_event, acts.get(id=booking.commitment.class_id))] # roles assigned direct to shows if booking.role in ('Stage Manager', 'Technical Director', 'Producer'): manage_shows += [booking.event] # staff leads often work a volunteer slot in the show elif self.is_staff_lead and hasattr(booking.event, 'container_event'): parent = booking.event.container_event.parent_event if parent not in manage_shows and Show.objects.filter( eventitem_id=parent.eventitem.eventitem_id).exists( ) and parent not in manage_shows: manage_shows += [parent] if booking.event.pk not in booking_ids: bookings += [booking_item] booking_ids += [booking.event.pk] current_conf = get_current_conference() # filter for conf AFTER bookings if self.historical: acts = acts.filter(b_conference__status="completed") else: acts = acts.exclude(b_conference__status="completed") context = { 'profile': viewer_profile, 'historical': self.historical, 'alerts': viewer_profile.alerts(shows, classes), 'personae': personae, 'troupes': troupes, 'manage_shows': manage_shows, 'businesses': viewer_profile.business_set.all(), 'acts': acts, 'shows': shows, 'proposed_classes': viewer_profile.proposed_classes(self.historical), 'vendors': viewer_profile.vendors(self.historical), 'costumes': viewer_profile.get_costumebids(self.historical), 'review_items': bids_to_review, 'tickets': get_purchased_tickets(viewer_profile.user_object), 'acceptance_states': acceptance_states, 'admin_message': self.admin_message, 'bookings': bookings, 'act_paid': verify_performer_app_paid(viewer_profile.user_object.username, current_conf), 'vendor_paid': verify_vendor_app_paid(viewer_profile.user_object.username, current_conf), 'logged_in_message': UserMessage.objects.get_or_create(view="LandingPageView", code="GENERAL_MESSAGE", defaults={ 'summary': "Left hand sidebar message", 'description': '' })[0].description } if not self.historical: user_message = UserMessage.objects.get_or_create( view="LandingPageView", code="ABOUT_INTERESTED", defaults={ 'summary': "About Interested Attendees", 'description': interested_explain_msg }) right_side_msg = UserMessage.objects.get_or_create( view="LandingPageView", code="CURRENT_BID_INSTRUCTION", defaults={ 'summary': "Right Hand Sidebar - Current Bid Message", 'description': current_bid_msg }) context['interested_info'] = user_message[0].description else: right_side_msg = UserMessage.objects.get_or_create( view="LandingPageView", code="HISTORICAL_BID_INSTRUCTION", defaults={ 'summary': "Right Hand Sidebar - Historical Bid Message", 'description': historic_bid_msg }) context['right_side_intro'] = right_side_msg[0].description return render(request, 'gbe/landing_page.tmpl', context)