Use reverse url. https://docs.djangoproject.com/en/dev/ref/templates/builtins/#url