def clean_city(self): """City cleaner. Check that entered city match with the city regexp Fetch the associated City object """ self.city_obj = City.get_city(self.cleaned_data['city']) if self.city_obj: return self.cleaned_data['city'] raise forms.ValidationError(_("Incorrect city."))
def clean_departure(self): """Departure city cleaner Checks that the city match with the city displaying regexp. Fetch the associated city object """ self.departure_obj = City.get_city(self.cleaned_data["departure"]) if not self.departure_obj and self.cleaned_data["departure"]: raise forms.ValidationError(_("Incorrect city.")) return self.cleaned_data["departure"]
def clean_departure(self): """Departure city cleaner Checks that the city match with the city displaying regexp. Fetch the associated city object """ self.departure_obj = City.get_city(self.cleaned_data['departure']) if not self.departure_obj and self.cleaned_data['departure']: raise forms.ValidationError(_("Incorrect city.")) return self.cleaned_data['departure']
def clean_arrival(self): """Arrival city cleaner Checks that the city match with the city displaying regexp. Fetch the associated city object Fetche l'objet City associé. """ self.arrival_obj = City.get_city(self.cleaned_data["arrival"]) if not self.arrival_obj and self.cleaned_data["arrival"]: raise forms.ValidationError(_("Incorrect city.")) return self.cleaned_data["arrival"]
def clean_arrival(self): """Arrival city cleaner Checks that the city match with the city displaying regexp. Fetch the associated city object Fetche l'objet City associé. """ self.arrival_obj = City.get_city(self.cleaned_data['arrival']) if not self.arrival_obj and self.cleaned_data['arrival']: raise forms.ValidationError(_("Incorrect city.")) return self.cleaned_data['arrival']