mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #8261 -- ModelAdmin hook for customising the "show on site" button
``ModelAdmin.view_on_site`` defines wether to show a link to the object on the admin detail page. If ``True``, cleverness (i.e. ``Model.get_absolute_url``) is used to get the url. If it's a callable, the callable is called with the object as the only parameter. If ``False``, not link is displayed. With the aim of maitaining backwards compatibility, ``True`` is the default.
This commit is contained in:
committed by
Simon Charette
parent
497930b7f6
commit
fd219fa24c
@@ -717,3 +717,19 @@ class EmptyModelHidden(models.Model):
|
||||
|
||||
class EmptyModelMixin(models.Model):
|
||||
""" See ticket #11277. """
|
||||
|
||||
class State(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class City(models.Model):
|
||||
state = models.ForeignKey(State)
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Restaurant(models.Model):
|
||||
city = models.ForeignKey(City)
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Worker(models.Model):
|
||||
work_at = models.ForeignKey(Restaurant)
|
||||
name = models.CharField(max_length=50)
|
||||
surname = models.CharField(max_length=50)
|
||||
|
||||
Reference in New Issue
Block a user