From 904655c2932024e9eb71351ca436244eef468b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 15 Dec 2019 16:11:50 +0100 Subject: [PATCH] misc: add context elements to have navigation/footer in mellon pages (#19515) --- .../base.html => combo/mellon_base_template.html} | 4 ---- combo/public/views.py | 9 +++++++++ combo/urls.py | 9 +++++++-- debian/control | 2 +- tox.ini | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) rename combo/public/templates/{mellon/base.html => combo/mellon_base_template.html} (65%) diff --git a/combo/public/templates/mellon/base.html b/combo/public/templates/combo/mellon_base_template.html similarity index 65% rename from combo/public/templates/mellon/base.html rename to combo/public/templates/combo/mellon_base_template.html index 7e615a58..78ab1895 100644 --- a/combo/public/templates/mellon/base.html +++ b/combo/public/templates/combo/mellon_base_template.html @@ -1,11 +1,7 @@ {% extends "combo/page_template.html" %} -{% block menu %}{% endblock %} - {% block combo-content %} {% block mellon_content %} {% endblock %} {% endblock %} -{% block footer %} -{% endblock %} diff --git a/combo/public/views.py b/combo/public/views.py index e607a82e..db6a0280 100644 --- a/combo/public/views.py +++ b/combo/public/views.py @@ -524,6 +524,15 @@ def error404(request, *args, **kwargs): template_name = 'combo/404.html' return publish_page(request, page, status=404, template_name=template_name) +def mellon_page_hook(context): + page = Page() + page.title = 'Hello' + page.template_name = 'standard' + context['page'] = page + home = Page.objects.filter(slug='index', parent=None).first() + if home: + context['page_cells'] = CellBase.get_cells(page=home) + def menu_badges(request): context = {'request': request} page_ids = [x for x in request.GET.getlist('page[]') if x.isdigit()] diff --git a/combo/urls.py b/combo/urls.py index 634b6481..f085dbc4 100644 --- a/combo/urls.py +++ b/combo/urls.py @@ -23,7 +23,7 @@ from django.views.i18n import javascript_catalog from .urls_utils import decorated_includes, manager_required -from .public.views import login, logout, error404 +from .public.views import login, logout, error404, mellon_page_hook from .manager.urls import urlpatterns as combo_manager_urls from . import plugins @@ -41,7 +41,12 @@ urlpatterns = [ handler404 = error404 if 'mellon' in settings.INSTALLED_APPS: - urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls'))) + urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls'), + kwargs={ + 'template_base': 'combo/mellon_base_template.html', + 'context_hook': mellon_page_hook, + }) + ) # static and media files urlpatterns += staticfiles_urlpatterns() diff --git a/debian/control b/debian/control index 12da38f9..bd4df544 100644 --- a/debian/control +++ b/debian/control @@ -39,7 +39,7 @@ Depends: ${misc:Depends}, python3-hobo (>= 1.34), python3-django-tenant-schemas, python3-psycopg2, - python3-django-mellon, + python3-django-mellon (>= 1.12), uwsgi, uwsgi-plugin-python3 Recommends: nginx diff --git a/tox.ini b/tox.ini index 31c313e0..173e37da 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ deps = pylint-django<0.8.1 django-webtest<1.9.3 psycopg2 - django-mellon + django-mellon>=1.12 py2: django-jsonfield<1.3 py2: quixote<3.0 py2: vobject