How to implement a common function in Django for same URL pattern?

I want to have a common function for APIs' of the same pattern which should run that function and then the API's function. For example, I want to call the API - api/student/details which would return the user details and there are a lot of APIs with the pattern - api/student/*. For all the APIs with this pattern, I want to check if the user in request body is a valid student. And then it should call the function associated with api/student/details. How do I implement this in django?

Back to Top