say this is my url:
url(r'^$', mainApp_views.homepage),
Is it possible to check this text = "mainApp_views.homepage" in view and middleware ?
Thanks in advance,
say this is my url:
url(r'^$', mainApp_views.homepage),
Is it possible to check this text = "mainApp_views.homepage" in view and middleware ?
Thanks in advance,
As of Django 2.0, you need to import resolve from django.urls:
from django.urls import resolve
def your_view(request):
url_name = resolve(request.path).url_name
print(url_name) #prints the "name" attribute in your urlpatterns