Skip to content

Instantly share code, notes, and snippets.

@nottrobin
Created January 8, 2014 16:43
Show Gist options
  • Select an option

  • Save nottrobin/8319868 to your computer and use it in GitHub Desktop.

Select an option

Save nottrobin/8319868 to your computer and use it in GitHub Desktop.
Django function to get URL names
from django.core import urlresolvers
def url_names():
default_resolvers = urlresolvers.get_resolver(None).reverse_dict.items()
named_resolvers = filter(lambda x: type(x[0]) is str, default_resolvers)
url_names = [x[0] for x in named_resolvers]
return url_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment