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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue