def general_listing(request, isAlumniFilter, isPledgeFilter, name): ''' Retrieves all of the information necessary for each of the brother listings. Retrieves information based on the isAlumniFilter and isPledgeFilter ''' brothers_count = PageHelper.get_request_count(request, standard_brothers_per_page, max_brothers_per_page) page_number = PageHelper.get_page_number(request) brothers_range_min = (page_number - 1) * brothers_count brothers_range_max = (page_number) * brothers_count brothers = Brother.objects.filter(isAlumni=isAlumniFilter, isPledge=isPledgeFilter).order_by( 'lastName', 'firstName', 'middleName') number_of_brothers = len(brothers) total_pages = int(math.ceil(number_of_brothers / float(brothers_count))) brothers = brothers[brothers_range_min:brothers_range_max] brothers = convert_brothers_to_brotherentities(brothers) brother_list_list = utility.convert_array_to_YxZ(brothers, brothers_per_row) if len(brothers) > 0 else None page_numbers_list = PageHelper.calculate_page_range(total_pages, page_number, max_pages_listed_on_screen) next_page = page_number + 1 if number_of_brothers > brothers_range_max else 0 prev_page = page_number - 1 context_dict = { 'brotherType': name, 'brother_list_list' : brother_list_list, 'page_number' : page_number, 'prev_page': prev_page, 'next_page' : next_page, 'page_numbers' : page_numbers_list } if brothers_count != standard_brothers_per_page: context_dict['brothers_count'] = brothers_count c = Context(context_dict) t = loader.get_template('brothers_list.html') return HttpResponse(t.render(c))
def general_listing(request, isAlumniFilter, isPledgeFilter, name): ''' Retrieves all of the information necessary for each of the brother listings. Retrieves information based on the isAlumniFilter and isPledgeFilter ''' brothers_count = get_brother_count(request) page_number = get_page_number(request) brothers_range_min = (page_number - 1) * brothers_count brothers_range_max = (page_number) * brothers_count brothers = Brother.objects.filter(isAlumni=isAlumniFilter, isPledge=isPledgeFilter).order_by( 'lastName', 'firstName', 'middleName') number_of_brothers = len(brothers) total_pages = int(math.ceil(number_of_brothers / float(brothers_count))) brothers = brothers[brothers_range_min:brothers_range_max] brothers = convert_brothers_to_brotherentities(brothers) brother_list_list = utility.convert_array_to_YxZ( brothers, brothers_per_row) if len(brothers) > 0 else None page_numbers_list = calculate_page_range(total_pages, page_number) next_page = page_number + 1 if number_of_brothers > brothers_range_max else 0 prev_page = page_number - 1 context_dict = { 'brotherType': name, 'brother_list_list': brother_list_list, 'page_number': page_number, 'prev_page': prev_page, 'next_page': next_page, 'page_numbers': page_numbers_list } if brothers_count != standard_brothers_per_page: context_dict['brothers_count'] = brothers_count c = Context(context_dict) t = loader.get_template('brothers_list.html') return HttpResponse(t.render(c))
def officers(request): officers = Officer.objects.filter().order_by('ordering') officers_matrix = utility.convert_array_to_YxZ(officers, officers_per_row) c = Context({'officer_list_list': officers_matrix}) t = loader.get_template('officers_list.html') return HttpResponse(t.render(c))