-1

I wanted to get django re_path's name parameter value from request or in any way.

I have a url pattern like that,

re_path(r'^user/query/page/list$', views.UserListView.as_view(), name="user_list")

When request comes with user/query/page/list, I want to match it with name or directly get name of the path that described in re_path.

I checked all request data and didn't reach it.

1 Answers1

0

It can be accessed from the request object

current_url = request.resolver_match.url_name
ilyasbbu
  • 1,468
  • 4
  • 11
  • 22