Can you use django's built-in resolve() instead?