Last active
September 24, 2015 05:17
-
-
Save crccheck/673062 to your computer and use it in GitHub Desktop.
Too lazy to figure out what view goes with what url? Me too
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on http://stackoverflow.com/questions/797773/django-caching-can-it-be-done-pre-emptively | |
# run this from `manage.py shell` | |
# if you have ipython, you can do `what_view /some/silly/url/` and remember the leading and trailing slash | |
from django.core.urlresolvers import resolve | |
def what_view(url): | |
try: | |
(v, foo, params) = resolve(url) | |
print "View Name: %s Line: %s of %s" % (v.__name__, v.__code__.co_firstlineno, v.__code__.co_filename) | |
return v, foo, params | |
except: | |
raise | |
# dummy text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment