예제 #1
0
파일: models.py 프로젝트: simone/upy
 def get_query_set(self):
     try:
         return super(self.__class__, self).get_query_set().filter(
             publication=get_publication(),
             language__code__iexact=translation.get_language())
     except:
         return super(self.__class__, self).get_empty_query_set()
예제 #2
0
파일: models.py 프로젝트: simone/upy
 def get_query_set(self):
     try:
         g11nmodel = models.get_model(self.model._meta.app_label,self.model.G11nMeta.g11n)
         db_table = g11nmodel._meta.db_table
         select_dict = dict([(field.column,"%s.%s" % (db_table,field.column)) for field in g11nmodel._meta.fields if field.name not in ['id',self.model.G11nMeta.fieldname]])
         filter_dict = {"%s__language__code__iexact" % self.model.G11nMeta.g11n.lower():translation.get_language(), 
                        "%s__publication" % self.model.G11nMeta.g11n.lower(): get_publication()}
         return super(G11nBaseCurrentManager, self).get_query_set().extra(select=select_dict,tables=('%s' % (db_table),)).filter(**filter_dict)
     except:
         raise
예제 #3
0
파일: models.py 프로젝트: simone/upy
 def get_query_set(self):
     try:
         g11nmodel = models.get_model(self.model._meta.app_label,
                                      self.model.G11nMeta.g11n)
         db_table = g11nmodel._meta.db_table
         select_dict = dict([
             (field.column, "%s.%s" % (db_table, field.column))
             for field in g11nmodel._meta.fields
             if field.name not in ['id', self.model.G11nMeta.fieldname]
         ])
         filter_dict = {
             "%s__language__code__iexact" % self.model.G11nMeta.g11n.lower(
             ):
             translation.get_language(),
             "%s__publication" % self.model.G11nMeta.g11n.lower():
             get_publication()
         }
         return super(G11nBaseCurrentManager, self).get_query_set().extra(
             select=select_dict,
             tables=('%s' % (db_table), )).filter(**filter_dict)
     except:
         raise
예제 #4
0
파일: models.py 프로젝트: simone/upy
def get_current_publication():
    """
    It returns current publication saved in current thread
    """
    return get_publication()
예제 #5
0
파일: models.py 프로젝트: simone/upy
def get_current_publication():
    """
    It returns current publication saved in current thread
    """
    return get_publication()
예제 #6
0
파일: models.py 프로젝트: simone/upy
 def get_query_set(self):
     try:
         return super(self.__class__, self).get_query_set().filter(publication=get_publication(),language__code__iexact=translation.get_language())
     except:
         return super(self.__class__, self).get_empty_query_set()