From e8260189f3becdb92786d52416fe84daaf118212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Tue, 16 May 2017 17:59:48 +0200 Subject: [PATCH] add fragment_child_models.html --- .../editor/templates/editor/fragment_child_models.html | 8 ++++++++ src/c3nav/editor/templates/editor/index.html | 6 +----- src/c3nav/editor/views.py | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/c3nav/editor/templates/editor/fragment_child_models.html diff --git a/src/c3nav/editor/templates/editor/fragment_child_models.html b/src/c3nav/editor/templates/editor/fragment_child_models.html new file mode 100644 index 00000000..8ede408f --- /dev/null +++ b/src/c3nav/editor/templates/editor/fragment_child_models.html @@ -0,0 +1,8 @@ +
+ {% for model in child_models %} + + {% if model.count %}{{ model.count }}{% endif %} + {{ model.title }} + + {% endfor %} +
diff --git a/src/c3nav/editor/templates/editor/index.html b/src/c3nav/editor/templates/editor/index.html index cf3e821a..7a9a722a 100644 --- a/src/c3nav/editor/templates/editor/index.html +++ b/src/c3nav/editor/templates/editor/index.html @@ -14,8 +14,4 @@ {% endfor %} -
- - Locationgroups - -
+{% include 'editor/fragment_child_models.html' %} diff --git a/src/c3nav/editor/views.py b/src/c3nav/editor/views.py index ede4ef22..a866b16d 100644 --- a/src/c3nav/editor/views.py +++ b/src/c3nav/editor/views.py @@ -8,7 +8,7 @@ from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.views.decorators.cache import never_cache -from c3nav.mapdata.models import Section +from c3nav.mapdata.models import LocationGroup, Section from c3nav.mapdata.models.base import EDITOR_FORM_MODELS @@ -28,6 +28,10 @@ def sidebar_view(func): def main_index(request): return render(request, 'editor/index.html', { 'sections': Section.objects.all(), + 'child_models': [{ + 'title': LocationGroup._meta.verbose_name_plural, + 'url': reverse('editor.locationgroups.list'), + }], })