﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4718	Add get_admin_url() to Model	cbrand@…	Adrian Holovaty	"From a discussion on django-users, I came up with this after contributions from two other people, one who originally got the code from elsewhere :
{{{
    def get_admin_url(self):
        pk = getattr(self, self._meta.pk.attname)
        return ('django.contrib.admin.views.main.change_stage',
                (self._meta.app_label,
                 self._meta.module_name,
                 pk))
    get_admin_url = models.permalink(get_admin_url)
}}}
There's nothing there that couldn't be done in the base Model class, and the fact that there were a number of people who'd seen a need for it indicates that it should at least be considered for inclusion int he base Model class.

On the downside, there's the question of what to do if the pk is None.
Also, admin is in contrib, which means that it could be omitted, but I wouldn't expect people who aren't using the admin to call the new method.
"		closed	Core (Other)	dev		wontfix		brooks.travis@…	Unreviewed	0	0	0	0	0	0
