diff --git a/dronken/views.py b/dronken/views.py index 2108705..230519d 100644 --- a/dronken/views.py +++ b/dronken/views.py @@ -13,10 +13,16 @@ class CityList(ListView): class AssociationList(ListView): template_name = 'associations.html' model = Association + city = None def get_queryset(self): - c = City.objects.get(slug=self.kwargs['city']) - return Association.objects.filter(city=c) + self.city = City.objects.get(slug=self.kwargs['city']) + return Association.objects.filter(city=self.city) + + def get_context_data(self, *args, **kwargs): + context = super(AssociationList, self).get_context_data(*args, **kwargs) + context['city'] = self.city + return context class DrunkUpdateForm(forms.ModelForm): diff --git a/redirects/index.php b/redirects/index.php index 871eb2a..9473ebb 100644 --- a/redirects/index.php +++ b/redirects/index.php @@ -2,7 +2,7 @@ ini_set('display_errors', true); ini_set('display_startup_errors', true); $association = explode(".", $_SERVER['HTTP_HOST']); -$association = $vereniging[0]; +$association = $association[0]; $city = "enschede"; switch($association){ case "interactief": diff --git a/templates/associations.html b/templates/associations.html index 229ce92..377576d 100644 --- a/templates/associations.html +++ b/templates/associations.html @@ -80,6 +80,8 @@ {{ association|safe }} {% if association.has_intern %}{{ association.state|upper }}{% else %}{{ association.short_name|safe|upper }} HEEFT GEEN INTERN!{% endif %} + {% empty %} +

{{ city.name }} heeft helemaal geen verenigingen!

{% endfor %}