22 lines
678 B
Python
22 lines
678 B
Python
from django.conf import settings
|
|
from django.urls import reverse, NoReverseMatch
|
|
from django.views import generic
|
|
|
|
|
|
class RootView(generic.TemplateView):
|
|
template_name = 'dav_base/root.html'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
c = super().get_context_data(**kwargs)
|
|
root_urls = []
|
|
for module_meta_obj in settings.MODULE_CONFIG.modules.values():
|
|
root_url_name = module_meta_obj.root_url_name
|
|
try:
|
|
reverse(root_url_name)
|
|
root_urls.append((module_meta_obj.package, root_url_name))
|
|
except NoReverseMatch:
|
|
pass
|
|
|
|
c['root_urls'] = root_urls
|
|
return c
|