Given a uri like /home/ I want to find the view function that this corresponds to, preferably in a form like app.views.home or just <app_label>.<view_func>. Is there a function that will give me this?
Given a uri like /home/ I want to find the view function that this
Share
You can use the resolve method provided by django to get the function. You can use the
__module__attribute of the function returned to get the app label. This will return a string likeproject.app.views. So something like this:In case one needs the class of the view since a class based view is being used one can access the
view_classof the returned function: