Is there an inverse method for Django's django.core.urlresolvers.reverse()
?
I want a function f(x)
such that f(django.core.urlresolvers.reverse('shadowfax')) == 'shadowfax'
.
Does anybody have anything to say on whether this would be a proper approach to writing unit tests for methods that call .reverse()
?
Probably shocking:
django.core.urlresolvers.resolve( "/test" ).url_name
It is perfectly good way to use it and it is even recommend in the documentation: