Added optional user and group on custom field (#12206)

* added group and user model to object_type

* Update netbox/utilities/utils.py

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Abhimanyu Saharan
2023-04-10 22:10:13 +05:30
committed by GitHub
parent 278f2b173a
commit 2c07762b7a
2 changed files with 6 additions and 1 deletions

View File

@@ -48,6 +48,10 @@ def get_viewname(model, action=None, rest_api=False):
if is_plugin:
viewname = f'plugins-api:{app_label}-api:{model_name}'
else:
# 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'
viewname = f'{app_label}-api:{model_name}'
# Append the action, if any
if action: