When I get a request for a path that includes the word "I", I want to replace it with the user ID before matching it with the URL. I tried using middleware as follows:
def process_request(self, request): if '/self/' in request.path: request.path = request.path.replace('/self/','/' + str(request.user.id) + '/')
Replacement works, but apparently does after matching the URL. Is there any way to change the path to this point?
source share