示例#1
0
文件: forms.py 项目: almet/bv.server
    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."))
示例#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"]
示例#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."))
示例#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']
示例#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"]
示例#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']