update for user filter on location

This commit is contained in:
Mohamed Nouffer
2022-12-29 19:19:43 +05:30
parent 64ed859210
commit 48eb21b115

View File

@ -205,9 +205,13 @@ def ExtentForMainPerf(request):
# iata = serializers.serialize("json",ext) # iata = serializers.serialize("json",ext)
return JsonResponse(ext, safe=False) return JsonResponse(ext, safe=False)
@api_view(['POST',])
@permission_classes((IsAuthenticated,))
@csrf_exempt
def ExtentForLocations(request): def ExtentForLocations(request):
locs = Location.objects.aggregate(Extent('geom'), Union('geom')) user = request.user
print(user.email)
locs = Location.objects.filter(group__contains=user.group).aggregate(Extent('geom'), Union('geom'))
return JsonResponse(locs['geom__extent'], safe=False) return JsonResponse(locs['geom__extent'], safe=False)