Notifications
Clear all
Build a Stock Prediction Portal – Django, React & Machine Learning
2
Posts
2
Users
0
Reactions
91
Views
0
25/12/2024 7:27 am
Topic starter
Hello and Merry Christmas,
Do you have any documentation about how to create advance filtering and custom pagination while using APIView and @api_view decorator?
For example, if I want to create advanced filtering and custom pagination for the following
@api_view(['GET', 'POST']) def studentView(request): if request.method == 'GET': # get all students from the student table students = Student.objects.all() serializer = StudentSerializer(students, many=True) return Response(serializer.data, status=status.HTTP_200_OK) elif request.method == 'POST': serializer = StudentSerializer(data = request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
2 Answers
0
31/12/2024 11:37 am
Hi Estiverne Yardley,
For advanced filtering, you can search on Google and YouTube, where you'll find many tutorials on this topic. If I were to suggest a video, it would be this one: https://youtu.be/NDFgTGTI8zg.
You can learn about this from the video. If you have any confusion or need further help, feel free to ask.
0
01/01/2025 12:46 am
Topic starter
ok thx!