mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #11775 -- Made ABSOLUTE_URL_OVERRIDES work with models that don't define get_absolute_url().
Thanks jukvalim for the report and initial patch, and Preston Timmons for review.
This commit is contained in:
parent
e5ae03fd5a
commit
c32bc1a7a7
5 changed files with 70 additions and 15 deletions
|
@ -28,7 +28,7 @@ ABSOLUTE_URL_OVERRIDES
|
|||
Default: ``{}`` (Empty dictionary)
|
||||
|
||||
A dictionary mapping ``"app_label.model_name"`` strings to functions that take
|
||||
a model object and return its URL. This is a way of overriding
|
||||
a model object and return its URL. This is a way of inserting or overriding
|
||||
``get_absolute_url()`` methods on a per-installation basis. Example::
|
||||
|
||||
ABSOLUTE_URL_OVERRIDES = {
|
||||
|
@ -39,6 +39,11 @@ a model object and return its URL. This is a way of overriding
|
|||
Note that the model name used in this setting should be all lower-case, regardless
|
||||
of the case of the actual model class name.
|
||||
|
||||
.. versionchanged:: 1.7.1
|
||||
|
||||
``ABSOLUTE_URL_OVERRIDES`` now works on models that don't declare
|
||||
``get_absolute_url()``.
|
||||
|
||||
.. setting:: ADMINS
|
||||
|
||||
ADMINS
|
||||
|
|
|
@ -26,3 +26,8 @@ Bugfixes
|
|||
|
||||
* Fixed a typo in an ``inlineformset_factory()`` error message that caused a
|
||||
crash (:ticket:`23451`).
|
||||
|
||||
* Restored the ability to use :setting:`ABSOLUTE_URL_OVERRIDES` with the
|
||||
``'auth.User'`` model (:ticket:`11775`). As a side effect, the setting now
|
||||
adds a ``get_absolute_url()`` method to any model that appears in
|
||||
``ABSOLUTE_URL_OVERRIDES`` but doesn't define ``get_absolute_url()``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue