def _translate_args_kwargs(self, *args, **kwargs): # Translate args (Q objects) from '<shared_field>' to # 'master__<shared_field>' where necessary. newargs = deepcopy(args) for q in newargs: for child, children, index in q_children(q): children[index] = (self.field_translator(child[0]), child[1]) # Translated kwargs from '<shared_field>' to 'master__<shared_field>' # where necessary. newkwargs = dict((self.field_translator(key), value) for key, value in kwargs.items()) return newargs, newkwargs
def _translate_args_kwargs(self, *args, **kwargs): self.language(self._language_code) language_joins = set() extra_filters = Q() newkwargs = dict( (self._translate(key, self.model, language_joins), value) for key, value in kwargs.items()) newargs = deepcopy(args) for q in newargs: for child, children, index in q_children(q): children[index] = (self._translate(child[0], self.model, language_joins), child[1]) for langjoin in language_joins: extra_filters &= Q(**{langjoin: self._language_code}) return newargs, newkwargs, extra_filters
def _translate_args_kwargs(self, *args, **kwargs): self.language(self._language_code) language_joins = set() extra_filters = Q() newkwargs = dict( (self._translate(key, self.model, language_joins), value) for key, value in kwargs.items() ) newargs = deepcopy(args) for q in newargs: for child, children, index in q_children(q): children[index] = (self._translate(child[0], self.model, language_joins), child[1]) for langjoin in language_joins: extra_filters &= Q(**{langjoin: self._language_code}) return newargs, newkwargs, extra_filters