Opened 11 months ago

Last modified 11 months ago

#35076 closed Cleanup/optimization

improvement to the doc of ModelAdmin.view_on_site — at Initial Version

Reported by: redstoneleo Owned by: nobody
Component: Documentation Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Whether get_absolute_url() is defined determines the visible state of the “View on site” button, I suggest to change [the doc](https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.view_on_site) to the following to emphasize this(Note I have read the official doc on contributing to the doc, but it is hard for me to do that, so I posted my suggestion here ).

If the object’s [get_absolute_url()](https://docs.djangoproject.com/en/4.2/ref/models/instances/#django.db.models.Model.get_absolute_url "django.db.models.Model.get_absolute_url") method is defined, then set view_on_site to control whether or not to display the “View on site” link. This link should bring you to a URL where you can display the saved object. Otherwise, no effect.

This value can be either a boolean flag or a callable. If True (the default), the object’s [get_absolute_url()](https://docs.djangoproject.com/en/4.2/ref/models/instances/#django.db.models.Model.get_absolute_url "django.db.models.Model.get_absolute_url") method will be used to generate the url.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top