I know the link template to reach an object is like following:
"{{ domain }}/{{ admin_dir }}/{{ appname }}/{{ modelname }}/{{ pk }}"
Is there a way built-in to get a permalink for an object?
from django.contrib import admin
def get_admin_permalink(instance, admin_site=admin.site):
# returns admin URL for instance change page
raise NotImplemented
EDIT
It seems in v1.1 admin has named URLs. Unfortunately it’s not yet released.
1.1 is out, the doc is right here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#admin-reverse-urls
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url
I also used it a bit, the admin namespace will have to be specified whenever you are fetching an existing admin url.
In 1.1, whenever an admin url is fetched, you’ll have to specify the ‘admin’ namespace.