From 36efadab1a0f0bcc8e9767411e518427781c55ff Mon Sep 17 00:00:00 2001 From: nickmwangemi Date: Tue, 15 Aug 2023 08:37:54 +0300 Subject: [PATCH] Add by-laws on lawlibrary --- lawlibrary/constants.py | 1 + lawlibrary/context_processors.py | 10 ++++++ lawlibrary/settings.py | 4 +++ .../liiweb/municipal_legislation.html | 23 ------------ .../open_by_laws/municipal_by_laws_list.html | 34 ------------------ .../peachjam/legislation_detail.html | 27 +++++++++----- lawlibrary/urls.py | 16 --------- lawlibrary/views/legislation.py | 19 ++++++---- liiweb/templates/liiweb/_legislation_nav.html | 36 +++++++++++++++++++ .../liiweb/locality_legislation.html | 2 +- .../liiweb/locality_legislation_list.html | 21 ++--------- liiweb/views/legislation.py | 25 ++++++------- 12 files changed, 99 insertions(+), 119 deletions(-) create mode 100644 lawlibrary/constants.py create mode 100644 lawlibrary/context_processors.py delete mode 100644 lawlibrary/templates/liiweb/municipal_legislation.html delete mode 100644 lawlibrary/templates/open_by_laws/municipal_by_laws_list.html create mode 100644 liiweb/templates/liiweb/_legislation_nav.html diff --git a/lawlibrary/constants.py b/lawlibrary/constants.py new file mode 100644 index 000000000..8dc7106c1 --- /dev/null +++ b/lawlibrary/constants.py @@ -0,0 +1 @@ +PROVINCIAL_CODES = ["ec", "fs", "gp", "lp", "mp", "nc", "nw", "wc", "kzn", "transvaal"] diff --git a/lawlibrary/context_processors.py b/lawlibrary/context_processors.py new file mode 100644 index 000000000..6e3bbf4cf --- /dev/null +++ b/lawlibrary/context_processors.py @@ -0,0 +1,10 @@ +from lawlibrary.constants import PROVINCIAL_CODES + + +def lawlibrary(request): + """ + Add some useful context to templates. + """ + return { + "PROVINCIAL_CODES": PROVINCIAL_CODES, + } diff --git a/lawlibrary/settings.py b/lawlibrary/settings.py index a2a3e2b45..fcd5ef57c 100644 --- a/lawlibrary/settings.py +++ b/lawlibrary/settings.py @@ -7,3 +7,7 @@ JAZZMIN_SETTINGS["site_title"] = "Lawlibrary" # noqa JAZZMIN_SETTINGS["site_header"] = "Lawlibrary" # noqa JAZZMIN_SETTINGS["site_brand"] = "Lawlibrary.org.za" # noqa + +TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa + "lawlibrary.context_processors.lawlibrary" +) diff --git a/lawlibrary/templates/liiweb/municipal_legislation.html b/lawlibrary/templates/liiweb/municipal_legislation.html deleted file mode 100644 index de33f8d4c..000000000 --- a/lawlibrary/templates/liiweb/municipal_legislation.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "peachjam/layouts/main.html" %} -{% load i18n %} -{% block title %}{{ locality_legislation_title }}{% endblock %} -{% block page-content %} -
-
-

{{ locality_legislation_title }}

-
- {% for group in municipality_groups %} -
- -
- {% endfor %} -
-
-
-{% endblock %} diff --git a/lawlibrary/templates/open_by_laws/municipal_by_laws_list.html b/lawlibrary/templates/open_by_laws/municipal_by_laws_list.html deleted file mode 100644 index 46eb68568..000000000 --- a/lawlibrary/templates/open_by_laws/municipal_by_laws_list.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends "liiweb/legislation_list.html" %} -{% load i18n %} -{% block title %} - {% blocktrans with locality=locality.name %}{{ locality }} By-laws{% endblocktrans %} -{% endblock %} -{% block breadcrumbs %} - -{% endblock %} -{% block page-heading %} -

{% blocktrans with locality=locality.name %}{{ locality }} By-laws{% endblocktrans %}

-{% endblock %} -{% block legislation-nav %} - -{% endblock %} diff --git a/lawlibrary/templates/peachjam/legislation_detail.html b/lawlibrary/templates/peachjam/legislation_detail.html index 5a43633c8..a00255836 100644 --- a/lawlibrary/templates/peachjam/legislation_detail.html +++ b/lawlibrary/templates/peachjam/legislation_detail.html @@ -3,14 +3,25 @@ {% block breadcrumbs %}