Login

Snippets by kuchin

Snippet List

Middleware to resolve current URL to module and view

Add it to MIDDLEWARE_CLASSES and you will get request.current_view getting values like "connection.views.index" or "django.views.static.serve" - one example usage is to show different help text based on current view name. EDIT: actually, you can use process_view middleware function where you automatically get current_view as first parameter.

  • middleware
  • view
  • url
  • resolve
Read More

kuchin has posted 1 snippet.