home / django_tickets / tickets

tickets: 8261

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
8261 2008-08-12 15:29:59 2013-10-29 21:10:53 2022-03-06 03:41:47.131406 Ready for checkin closed contrib.admin New feature Normal dev fixed ModelAdmin hook for customising the "show on site" button 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". }}} unaizalakain jarrow   0 1 0 0 0 1
Powered by Datasette · Queries took 0.932ms