I build a dynamic breadcumb, and some parts of it are not valid urls (are not in urlpatterns).
I have this templatetag:
@register.filter
def crumbs(url):
"Return breadcrumb trail leading to URL for this page"
l = url.split('/')
urls = []
path = ""
for index, item in enumerate(l):
if item == "":
continue
path += item + "/"
urls.append({'path':path,'name':item})
Now, I want to check if that specific URL is a valid url, ie, have a key in urlpatterns (of curse I will need to change my templatetag).
Something like:
IsInUrlPattern('/') => True
IsInUrlPattern('/blog/2004/') => True
IsInUrlPattern('/blog/thisfail/') => False
You want the resolve() function.