Skip to content

Commit

Permalink
languages, all munis
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Jul 24, 2023
1 parent e666907 commit 0c4020f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
5 changes: 0 additions & 5 deletions obl_microsites/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
from django.contrib.staticfiles import finders

searched_locations = finders.searched_locations


def obl_microsites(request):
if not hasattr(request, "microsite"):
return {}
Expand Down
18 changes: 17 additions & 1 deletion obl_microsites/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,23 @@

MICROSITES = {
"bergrivier": {
"code": "cpt",
"code": "wc013",
"website": "https://www.bergmun.org.za/",
},
"capeagulhas": {
"code": "wc033",
"website": "https://capeagulhas.gov.za/",
},
"cederberg": {
"code": "wc012",
"website": "http://www.cederbergmun.gov.za/",
},
"mbizana": {
"code": "ec443",
"website": "http://www.mbizana.gov.za/",
},
"matzikama": {
"code": "wc011",
"website": "https://www.matzikamamunicipality.co.za/",
},
}
18 changes: 18 additions & 0 deletions obl_microsites/templates/peachjam/_header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{% extends 'peachjam/_header.html' %}
{% load static %}
{% block top-bar %}
<div class="p-2 bg-dark">
<div class="container d-flex justify-content-end">
<a href="{{ MICROSITE.locality.website }}"
target="_blank"
rel="noreferrer"
class="ms-3 text-white">
{{ MICROSITE.locality.name }} website →
</a>
</div>
</div>
{% endblock %}
{% block navbar-logo %}
<img src="{% static 'images/municipalities/'|add:MICROSITE.code|add:"-logo.png" %}"
alt="{{ MICROSITE.locality.name }} By-laws"
height="70"/>
{% endblock %}
{% block nav-items %}
<li class="nav-item">
<a class="nav-link"
Expand Down
5 changes: 3 additions & 2 deletions obl_microsites/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

class RedirectHomeView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
if not getattr(self.request, "obl_locality", None):
if not getattr(self.request, "microsite", None):
raise Http404()

return reverse(
"municipal_by_laws", kwargs={"code": self.request.obl_locality.code}
"municipal_by_laws",
kwargs={"code": self.request.microsite["locality"].code},
)
6 changes: 6 additions & 0 deletions open_by_laws/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.utils.translation import gettext_lazy as _

from liiweb.settings import * # noqa

INSTALLED_APPS = ["open_by_laws.apps.OpenByLawsConfig"] + INSTALLED_APPS # noqa
Expand All @@ -12,3 +14,7 @@
TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa
"open_by_laws.context_processors.open_by_laws"
)

LANGUAGES = [
("en", _("English")),
]

0 comments on commit 0c4020f

Please sign in to comment.