def to_sql_filter(self): if self._is_dyn_date(): return BasicBetweenFilter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], ['start_date', 'end_date'])) elif self._is_empty(): if self.filter.get('datatype') in [ DATA_TYPE_DATE, DATA_TYPE_DATETIME ]: return ISNULLFilter(self.filter['field']) else: return ORFilter([ EQFilter(self.filter['field'], self.filter['slug']), ISNULLFilter(self.filter['field']), ]) elif self._is_exists(): if self.filter.get('datatype') in [ DATA_TYPE_DATE, DATA_TYPE_DATETIME ]: return NOTNULLFilter(self.filter['field']) else: # this resolves to != '', which also filters out null data in postgres return NOTEQFilter(self.filter['field'], self.filter['slug']) elif self._is_list(): return self._array_filter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], self.value['operand'])) else: return self._scalar_filter(self.filter['field'], self.filter['slug'])
def to_sql_filter(self): if self.show_all: return None if self.is_null: return ISNULLFilter(self.filter.field) return INFilter(self.filter.field, get_INFilter_bindparams(self.filter.slug, self.value))
def to_sql_filter(self): if self.show_all: return None if self.is_null: return ORFilter( [ISNULLFilter(field) for field in self.filter.fields]) return ORFilter([ INFilter(field, get_INFilter_bindparams(self.filter.slug, self.value)) for field in self.filter.fields ])
def to_sql_filter(self): if self.show_all: return None if self.is_null: return ISNULLFilter(self.filter['field']) in_filter = INFilter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], self.value)) if self._ancestor_filter: return ANDFilter([self._ancestor_filter.sql_filter(), in_filter]) else: return in_filter
def to_sql_filter(self): if self._is_dyn_date(): return BasicBetweenFilter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], ['start_date', 'end_date'])) elif self._is_empty(): return ORFilter([ EQFilter(self.filter['field'], self.filter['slug']), ISNULLFilter(self.filter['field']), ]) elif self._is_list(): return self._array_filter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], self.value['operand'])) else: return self._scalar_filter(self.filter['field'], self.filter['slug'])
def to_sql_filter(self): if self.show_all: return None sql_filters = [] non_null_values = self._get_value_without_nulls() if non_null_values: in_filter = INFilter( self.filter['field'], get_INFilter_bindparams(self.filter['slug'], non_null_values) ) if self._ancestor_filter: sql_filters.append(ANDFilter([ self._ancestor_filter.sql_filter(), in_filter, ])) else: sql_filters.append(in_filter) elif self._ancestor_filter: sql_filters.append(self._ancestor_filter.sql_filter()) if self.is_null: # combine null and blank fields into a single filter sql_filters.append( ORFilter([ ISNULLFilter(self.filter['field']), EQFilter(self.filter['field'], get_null_empty_value_bindparam(self.filter['slug'])), ]) ) if len(sql_filters) > 1: return ORFilter( sql_filters ) else: return sql_filters[0]
def to_sql_filter(self): if self.show_all: return '' if self.is_null: return ISNULLFilter(self.filter.field) return INFilter(self.filter.field, self.filter.field)