def get_common_fields(self, check_type=True, local=True): model_fields = [] for queryset in self.querysets: db = queryset.db fields_with_dbtype = set( (field.name, field.db_type(connection=connections[db])) for field in queryset.model._meta.fields ) model_fields.append(fields_with_dbtype) return tuple(name for name, db_type in reduce_and(model_fields))
def get_search_q(self, request, query): terms = self.get_search_terms(query) if not terms or not self.search_fields: return None term_q_objs = [] for term, negate in terms: term_q = self.get_term_q(request, term) if negate: term_q = ~term_q term_q_objs.append(term_q) return reduce_and(term_q_objs)