> Small tweak to support models which don't use AutoField for primary_key.
> 
> def get_admin_url(self):
>    pk = getattr(self, self._meta.pk.attname)
>    return "/admin/%s/%s/%s/" % (
>       self._meta.app_label,
>       self._meta.module_name,
>       pk)

Hmmm. Nice, except that it hardcodes the base url of the admin, which leads
me to this :
    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)
Does that look reasonable?

Looks like something that could be part of models.Model...

Chris




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to