Ejemplo n.º 1
0
 def get_query_set(self):
     """ Adds TransQuerySet support """
     qs = super(TransManager, self).get_query_set()
     kwargs = {'query': qs.query}
     # Pass DB attribute if multi-db support is present.
     if MULTIDB_SUPPORT:
         kwargs['using'] = qs._db
     queryset = TransQuerySet(self.model, **kwargs)
     if get_do_autotrans():
         queryset = queryset.set_language(get_language().replace("-",""))
     return queryset
Ejemplo n.º 2
0
 def get_queryset(self):
     """ Adds TransQuerySet support """
     qs = super(TransManager, self).get_queryset()
     kwargs = {'query': qs.query}
     # Pass DB attribute if multi-db support is present.
     if MULTIDB_SUPPORT:
         kwargs['using'] = qs._db
     queryset = TransQuerySet(self.model, **kwargs)
     if get_do_autotrans():
         queryset = queryset.set_language(get_language().replace("-", ""))
     if hasattr(queryset, 'prefetch_related'):
         queryset = queryset.prefetch_related()
     return queryset
Ejemplo n.º 3
0
 def get_query_set(self):
     """ Adds TransQuerySet support """
     qs = super(TransManager, self).get_query_set()
     kwargs = {"query": qs.query}
     # Pass DB attribute if multi-db support is present.
     if MULTIDB_SUPPORT:
         kwargs["using"] = qs._db
     queryset = TransQuerySet(self.model, **kwargs)
     if get_do_autotrans():
         queryset = queryset.set_language(get_language().replace("-", ""))
     if hasattr(queryset, "prefetch_related"):
         queryset = queryset.prefetch_related()
     return queryset
Ejemplo n.º 4
0
    def get_query_set(self):
        """ Adds TransQuerySet support """
        qs = super(TransManager, self).get_query_set()
        kwargs = {'query': qs.query}
        # Pass DB attribute if multi-db support is present.
        if MULTIDB_SUPPORT:
            kwargs['using'] = qs._db

        trans_query_set_class = type('%sTransQuerySet' % self.model.__name__,
            (TransQuerySet, qs.__class__,), {})
        queryset = trans_query_set_class(self.model, **kwargs)

        if get_do_autotrans():
            queryset = queryset.set_language(get_language().replace("-", ""))
        if hasattr(queryset, 'prefetch_related'):
            queryset = queryset.prefetch_related()
        return queryset