I am trying to add a dynamic instead of a hard coded get_inspect_url
method to a PageModel
:
class MyModel(Page):
# ...
# this is what I have now, which breaks in prod due to a different admin url
def get_inspect_url(self):
inspect_url = f"/admin/myapp/mymodel/inspect/{self.id}/"
return inspect_url
I know that you can use the ModelAdmin.url_helper_class
in wagtail_hooks.py
to get admin urls for an object, but I can't figure a way to do the same on the model level as a class method. Is there a way?