README.md edited
This commit is contained in:
20
.venv/lib/python3.10/site-packages/jet/dashboard/utils.py
Normal file
20
.venv/lib/python3.10/site-packages/jet/dashboard/utils.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from importlib import import_module
|
||||
from jet.dashboard import settings
|
||||
|
||||
|
||||
def get_current_dashboard(location):
|
||||
if location == 'index':
|
||||
path = settings.JET_INDEX_DASHBOARD
|
||||
elif location == 'app_index':
|
||||
path = settings.JET_APP_INDEX_DASHBOARD
|
||||
else:
|
||||
raise ValueError('Unknown dashboard location: %s' % location)
|
||||
|
||||
module, cls = path.rsplit('.', 1)
|
||||
|
||||
try:
|
||||
module = import_module(module)
|
||||
index_dashboard_cls = getattr(module, cls)
|
||||
return index_dashboard_cls
|
||||
except ImportError:
|
||||
return None
|
||||
Reference in New Issue
Block a user