﻿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
8261	"ModelAdmin hook for customising the ""show on site"" button"	 	Unai Zalakain	"As Simon Willison [http://groups.google.com/group/django-developers/browse_thread/thread/6dd78862b887438c?hl=en& suggested on django developers]:

{{{
Further thinking about get_absolute_url. At the moment, the main 
reason it's a standard in Django is that it is used by 
django.contrib.admin to display the ""show on site"" button inside the 
admin interface. 

This mechanism isn't very robust. Admin sites are often run on 
different subdomains from the rest of the site, which means that 
get_absolute_url on its own isn't enough - instead, we have to go 
through the whole /r/{{ content-type-id }}/{{ object-id }}/ palaver 
which attempts to figure out the site based on ForeignKey(Site) 
properties on the model, or by using the default site from SITE_ID. 

It would make a lot more sense to allow ModelAdmin subclasses to 
define that behaviour themselves, for example: 

class ArticleAdmin(admin.ModelAdmin): 
    ... 
    def show_on_site(self, obj): 
        return 'http://livesite.example.com' + obj.get_url_path() 

We could even support ""show_on_site = True"" as meaning ""include the 
show on site link, using cleverness to figure out the link"" whereas 
show_on_site = a_callable means ""call this function to figure out the 
URL for that link"".
}}}"	New feature	closed	contrib.admin	dev	Normal	fixed		almir@…	Ready for checkin	1	0	0	0	0	1
