views.py 560 B

123456789101112131415
  1. from django.shortcuts import render
  2. from gauth.models import Location
  3. from name_extractor.models import Staff
  4. def leader_board(request, location_id):
  5. if location_id == '12345':
  6. staffs = Staff.objects.all().exclude(total_units=0.00).order_by('-total_units')
  7. else:
  8. staffs = Staff.objects.filter(location_id=location_id).exclude(total_units=0.00).order_by('-total_units')
  9. locations = Location.objects.all()
  10. context = {'er_locations': locations, 'staffs': staffs}
  11. return render(request, 'leaderboard.html', context=context)