jonge-democraten / website

JD website
https://jongedemocraten.nl
MIT License
6 stars 2 forks source link

Add flag for Friesland #209

Closed mathemaat closed 6 years ago

bartromgens commented 6 years ago

@mathemaat The unit tests fail (see https://travis-ci.org/jonge-democraten/website/builds/313962101) because request.META.HTTP_HOST is None during unit tests, which somehow causes the whole menu to disappear (not sure why).

This can be fixed by checking for existence of HTTP_HOST:

{% if request.META.HTTP_HOST and request.META.HTTP_HOST|contains:"friesland" %}

Note that you don't need a templatetag for a 'contains', you can simply do:

{% if "friesland" in request.META.HTTP_HOST %}

This also does not cause errors if HTTP_HOST is None :)

Good templatetag exercise anyway ;)

mathemaat commented 6 years ago

Ik dacht deze al afgerond was, maar inderdaad, de Travis build was niet gelukt.

Inmiddels staat er een nieuwe versie klaar.

bartromgens commented 6 years ago

:+1: