Add message if no associations in a city, fix php redirect script
This commit is contained in:
		
							parent
							
								
									788f95b45c
								
							
						
					
					
						commit
						4dda40f65c
					
				
					 3 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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":
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,6 +80,8 @@
 | 
			
		|||
                <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>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% empty %}
 | 
			
		||||
            <tr><td><h4>{{ city.name }} heeft helemaal geen verenigingen!</h4></td></tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue