Skip to content

Commit c0790a4

Browse files
committed
Allow excluding apps from the DAB URL inclusion
1 parent cd1fb34 commit c0790a4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ansible_base/lib/dynamic_config/dynamic_urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
installed_apps = getattr(settings, 'INSTALLED_APPS', [])
1414
for app in installed_apps:
1515
if app.startswith('ansible_base.'):
16+
if app in getattr(settings, 'ANSIBLE_BASE_APPS_EXCLUDE_VIEW_LIST', []):
17+
continue
1618
if not importlib.util.find_spec(f'{app}.urls'):
1719
logger.debug(f'Module {app} does not specify urls.py')
1820
continue

docs/lib/views.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ class DefaultAPIView(AnsibleBaseView):
4949
...
5050
```
5151

52+
### Turning off views for an app
53+
54+
It's possible you may want to use an app from DAB but not include views from that app.
55+
If you do not want any DAB views, that is relatively simple to do.
56+
However, to include views from all apps except for a certain list, you can use this setting, example:
57+
58+
```
59+
ANSIBLE_BASE_APPS_EXCLUDE_VIEW_LIST = ['ansible_base.rbac']
60+
```
61+
62+
This might be useful if you wanted to use the RBAC app at the ORM layer with your own views, in this example.
63+
5264

5365
## Adding extra related fields
5466

0 commit comments

Comments
 (0)