Answer the question
In order to leave comments, you need to log in
When adding Count, it throws an error: 'int' object is not iterable. JSON output. You need to know the number of objects. How is life??
class ActiveDriverGetPassgersToOut(generics.ListAPIView):
serializer_class = ActiveDriveSerializers
def get_queryset(self):
queryset = ActiveDriver.objects.all()
index = self.request.query_params.get('iddriver', None)
if index is not None:
qs = queryset.filter(idDriver__exact=index)
q = qs.filter(numberPassengers__ToStop__exact=F('Locate'))
queryset = q.count()
return queryset
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question