def _validate_upload_values(self, values, errors):
        """
        Validate uploaded driving data and add any errors to an errors object
        :param values: POST values dictionary
        :param errors: Object to add errors to
        """
        date_period_validator = DatetimePeriodValidator(errors)
        date_period_validator.get_valid_start_end_datetimes('dt_start', 'dt_end', values)

        # Validate the lat lon:
        if 'lat' not in values or values['lat'] == '':
            errors['lat'] = "Please enter a value"
        elif 'lon' not in values or values['lon'] == '':
            errors['lon'] = "Please enter a value"
        else:
            lat = float(values['lat'])
            lon = float(values['lon'])
            self._validate_lat_lon(errors, lat, lon)

        file = values['driving-file']
        if file == u'':
            errors['driving-file'] = "You must select a driving data file"
    def _validate_download_values(self, driving_data, errors, values):

        date_period_validator = DatetimePeriodValidator(errors)
        start, end = date_period_validator.get_valid_start_end_datetimes('dt_start', 'dt_end', values)

        if start is not None and end is not None:
            self.ascii_download_helper.get_actual_data_start(driving_data, start)
            self.ascii_download_helper.get_actual_data_end(driving_data, end)

        lat, lon = None, None
        if 'lat' not in values or values['lat'] == '':
            errors['lat'] = "Please enter a value"
        elif 'lon' not in values or values['lon'] == '':
            errors['lon'] = "Please enter a value"
        else:
            lat = float(values['lat'])
            lon = float(values['lon'])

            spatial_extent = SpatialExtent(driving_data.boundary_lat_north, driving_data.boundary_lat_south,
                                           driving_data.boundary_lon_west, driving_data.boundary_lon_east)

            ExtentsControllerHelper().validate_singlecell_spatial_extents(spatial_extent, errors, lat, lon)
        return lat, lon, start, end