Add message if no associations in a city, fix php redirect script
This commit is contained in:
parent
788f95b45c
commit
4dda40f65c
|
@ -13,10 +13,16 @@ class CityList(ListView):
|
||||||
class AssociationList(ListView):
|
class AssociationList(ListView):
|
||||||
template_name = 'associations.html'
|
template_name = 'associations.html'
|
||||||
model = Association
|
model = Association
|
||||||
|
city = None
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
c = City.objects.get(slug=self.kwargs['city'])
|
self.city = City.objects.get(slug=self.kwargs['city'])
|
||||||
return Association.objects.filter(city=c)
|
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):
|
class DrunkUpdateForm(forms.ModelForm):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
ini_set('display_errors', true);
|
ini_set('display_errors', true);
|
||||||
ini_set('display_startup_errors', true);
|
ini_set('display_startup_errors', true);
|
||||||
$association = explode(".", $_SERVER['HTTP_HOST']);
|
$association = explode(".", $_SERVER['HTTP_HOST']);
|
||||||
$association = $vereniging[0];
|
$association = $association[0];
|
||||||
$city = "enschede";
|
$city = "enschede";
|
||||||
switch($association){
|
switch($association){
|
||||||
case "interactief":
|
case "interactief":
|
||||||
|
|
|
@ -80,6 +80,8 @@
|
||||||
<td><b><a href="{% url 'dronken:association' association.city.slug association.slug %}">{{ association|safe }}</a></b></td>
|
<td><b><a href="{% url 'dronken:association' association.city.slug association.slug %}">{{ association|safe }}</a></b></td>
|
||||||
<td><b>{% if association.has_intern %}{{ association.state|upper }}{% else %}{{ association.short_name|safe|upper }} HEEFT GEEN INTERN!{% endif %}</b></td>
|
<td><b>{% if association.has_intern %}{{ association.state|upper }}{% else %}{{ association.short_name|safe|upper }} HEEFT GEEN INTERN!{% endif %}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr><td><h4>{{ city.name }} heeft helemaal geen verenigingen!</h4></td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue