From 4fc674476e008985bacb2b74656fe0b70aba173c Mon Sep 17 00:00:00 2001 From: nickmwangemi Date: Tue, 15 Aug 2023 18:44:46 +0300 Subject: [PATCH] By-laws on LawLibrary --- lawlibrary/constants.py | 1 + lawlibrary/context_processors.py | 10 ++++ lawlibrary/settings.py | 5 ++ lawlibrary/templates/peachjam/_header.html | 6 +++ .../peachjam/legislation_detail.html | 12 +++-- lawlibrary/urls.py | 16 ++++--- lawlibrary/views/legislation.py | 47 +++++++++++++++++-- .../liiweb/locality_legislation.html | 2 +- .../liiweb/locality_legislation_list.html | 13 +++-- liiweb/views/legislation.py | 6 ++- 10 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 lawlibrary/constants.py create mode 100644 lawlibrary/context_processors.py 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..39923b304 100644 --- a/lawlibrary/settings.py +++ b/lawlibrary/settings.py @@ -7,3 +7,8 @@ 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/peachjam/_header.html b/lawlibrary/templates/peachjam/_header.html index 14de65d0e..e4ca84bd8 100644 --- a/lawlibrary/templates/peachjam/_header.html +++ b/lawlibrary/templates/peachjam/_header.html @@ -27,6 +27,12 @@ {% trans 'Provincial Legislation' %} + - + {% if show_subleg %} + + {% endif %}