class studentList(APIView):

    def get(self, request, pk, pk2, format=None):
        student_detail = Student.objects.all()
if pk:
    student_detail = student_detail.filter(last_name=pk)
if pk2:
    student_detail = student_detail.filter(campus_id__name=pk2)
serialized_student_detail = studentSerializer(student_detail, many=True)
return Response(serialized_student_detail.data)
Django urls with empty values