Refactor: split code into several django apps (we call them modules).

This commit is contained in:
2018-12-13 14:47:58 +01:00
parent c23dc33d4e
commit 0d5a8c65e3
81 changed files with 739 additions and 332 deletions

23
dav_base/views.py Normal file
View File

@@ -0,0 +1,23 @@
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(RootView, self).get_context_data(**kwargs)
root_urls = []
for module_meta_obj in settings.MODULE_CONFIG.modules.values():
root_url_name = 'root'
if module_meta_obj.url_namespace:
root_url_name = '%s:%s' % (module_meta_obj.url_namespace, root_url_name)
try:
reverse(root_url_name)
root_urls.append((module_meta_obj.app, root_url_name))
except NoReverseMatch:
pass
c['root_urls'] = root_urls
return c