ABSOLUTE_URL_OVERRIDES doesn't work for the majority of contrib models
|Reported by:||Jukka Välimaa||Owned by:||Jukka Välimaa|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Jukka Välimaa||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
At the moment, ABSOLUTE_URL_OVERRIDES is used to override get_absolute_url methods. However, most models in django.contrib don't have the get_absolute_url method in the first place, and so ABSOLUTE_URL_OVERRIDES does nothing to them. This means that you can't have links from unmodified admin pages of these model objects to the page that represents the model object in the application. If there is code that relies on getting the url to object by get_absolute_url, there needs to be separate code to handle these model objects.
The reporter of this ticket came across both of these problems when wanting to link to the application page of a group (contrib.auth.models.Group) from admin, and from a general search.
Proposed solution: Make it possible for ABSOLUTE_URL_OVERRIDES to insert a function as get_absolute_url method of a model class, rather than only overriding existing methods. (Design decision needed on this one, I think)
Change History (16)
comment:2 Changed 7 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|