Exemplo n.º 1
0
    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."))
Exemplo n.º 2
0
    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"]
Exemplo n.º 3
0
    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."))
Exemplo n.º 4
0
    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']
Exemplo n.º 5
0
    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"]
Exemplo n.º 6
0
    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']