You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if parent_obj is None: # InlineActionsMixin.MODEL_ADMIN:
# redirect to `changelist`
url = reverse(
'admin:{}_{}_changelist'.format(
obj._meta.app_label,
obj._meta.model_name,
),
)
else:
# redirect to `changeform`
url = reverse(
'admin:{}_{}_change'.format(
parent_obj._meta.app_label,
parent_obj._meta.model_name,
),
args=(parent_obj.pk,),
)
I the way I would like to handle it:
Read the admin url name from admin class. if it's not found use default admin but it can be also overridden in settings
For example:
def get_admin_url_base_name() --> str:
"""
Return admin sitem base name can be extracted from self.admin_site
"""
url = reverse(
'admin:{}_{}_change'.format(
parent_obj._meta.app_label,
parent_obj._meta.model_name,
),
args=(parent_obj.pk,),
)
If you ok and agree with this issue I can handle it
The text was updated successfully, but these errors were encountered:
bdnettleton
added a commit
to bdnettleton/django-inline-actions
that referenced
this issue
Sep 15, 2022
Simple changes in admin.py to change reverse url lookup to use the proper admin site name instead of always using the default "admin".
Includes new custom_admin page in test_proj and tests to check that the reverse works properly.
I hit this issue as well and have submitted a pull request with a fix to handle custom admin pages. No need to implement another function as you can simply get the custom admin site name from self.admin_site.name.
I have a few admin pages i.g.
/admin/ ---> for company users (our company)
/c-admin --> for customer users
/super-admin/ ---> for me (everything is allowwed)
so I would like to add inline actions to
/c-admin/
but after pressing it it will redirect toadmin
defaul one cause:https://github.com/escaped/django-inline-actions/blob/master/inline_actions/admin.py#L205
I the way I would like to handle it:
Read the admin url name from admin class. if it's not found use default
admin
but it can be also overridden in settingsFor example:
If you ok and agree with this issue I can handle it
The text was updated successfully, but these errors were encountered: