Skip to content

Commit 48e0c33

Browse files
committed
Don't list REST API endpoints which don't provide access to any tables.
- Legacy-Id: 8749
1 parent 9cb2f17 commit 48e0c33

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ietf/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
_root, _name = _app.split('.', 1)
3434
if _root == 'ietf':
3535
if not '.' in _name:
36+
3637
_api = Api(api_name=_name)
3738
_module_dict[_name] = _api
3839
_api_list.append((_name, _api))
3940

4041
def top_level(request):
4142
available_resources = {}
4243

43-
for name in sorted([ name for name, api in _api_list ]):
44+
for name in sorted([ name for name, api in _api_list if len(api._registry) > 0 ]):
4445
available_resources[name] = {
4546
'list_endpoint': '/api/%s/' % name,
4647
}
@@ -72,7 +73,6 @@ def autodiscover():
7273
from django.utils.importlib import import_module
7374
from django.utils.module_loading import module_has_submodule
7475

75-
7676
for app in settings.INSTALLED_APPS:
7777
mod = import_module(app)
7878
# Attempt to import the app's admin module.

0 commit comments

Comments
 (0)