views.py 634 B

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