from django.shortcuts import render from gauth.models import Location from name_extractor.models import Staff from django.contrib.auth.decorators import login_required @login_required def leader_board(request, location_id): if location_id == '12345': staffs = Staff.objects.all().exclude(total_units=0.00).order_by('-total_units') else: staffs = Staff.objects.filter(location_id=location_id).exclude(total_units=0.00).order_by('-total_units') locations = Location.objects.all() context = {'er_locations': locations, 'staffs': staffs} return render(request, 'leaderboard.html', context=context)