1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes: #14840 - Forces API to use django user model instead of proxy model (#14881)

* Fixes: #14840 - Forces API to use proxy model

* Update tests to use proxy model

* Revert "Update tests to use proxy model"

This reverts commit 1d784cfe5d.

* Revert "Fixes: #14840 - Forces API to use proxy model"

This reverts commit df85cc967c.

* More realistic change to resole issue with netboxusers-list

* Revert "More realistic change to resole issue with netboxusers-list"

This reverts commit 15df8082aa.

* Fixes: #14840 - Better fix for netboxusers-list

* Swap model for serializer from proxy model
This commit is contained in:
Daniel Sheppard
2024-02-05 10:57:30 -06:00
committed by GitHub
parent 8e8d302850
commit 32083e58c0
2 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,8 @@ def get_viewname(model, action=None, rest_api=False):
# Alter the app_label for group and user model_name to point to users app
if app_label == 'auth' and model_name in ['group', 'user']:
app_label = 'users'
if app_label == 'users' and model._meta.proxy and model_name in ['netboxuser', 'netboxgroup']:
model_name = model._meta.proxy_for_model._meta.model_name
viewname = f'{app_label}-api:{model_name}'
# Append the action, if any