fix au cas où Place n'existe pas avant migration
This commit is contained in:
		@@ -182,6 +182,13 @@ class Place(models.Model):
 | 
			
		||||
    def match(self, event):
 | 
			
		||||
        return event.location in self.aliases
 | 
			
		||||
 | 
			
		||||
    def get_all_cities():
 | 
			
		||||
        try:
 | 
			
		||||
            tags = list([p["city"] for p in Place.objects.values("city").distinct().order_by("city")])
 | 
			
		||||
        except:
 | 
			
		||||
            tags = []
 | 
			
		||||
        return tags
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Event(models.Model):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ class EventFilter(django_filters.FilterSet):
 | 
			
		||||
 | 
			
		||||
    city = django_filters.MultipleChoiceFilter(label="Filtrer par ville",
 | 
			
		||||
        field_name='exact_location__city',
 | 
			
		||||
        choices=[(p["city"], p["city"]) for p in Place.objects.values("city").distinct().order_by("city")],
 | 
			
		||||
        choices=[(c, c) for c in Place.get_all_cities()],
 | 
			
		||||
        widget=forms.CheckboxSelectMultiple)
 | 
			
		||||
 | 
			
		||||
    status = django_filters.MultipleChoiceFilter(label="Filtrer par status",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user