コード例 #1
0
ファイル: views.py プロジェクト: Diacamma2/financial
 def get_items_from_filter(self):
     items = XferListEditor.get_items_from_filter(self)
     items = sorted(items, key=lambda t: six.text_type(t).lower())
     if self.getparam('show_filter', 0) == 2:
         items = [item for item in items if abs(item.get_total()) > 0.0001]
     res = QuerySet(model=Third)
     res._result_cache = items
     return res
コード例 #2
0
ファイル: views.py プロジェクト: Diacamma2/financial
 def filter_callback(self, items):
     items = sorted(items, key=lambda t: six.text_type(
         t))
     if (self.getparam('CRITERIA') is None) and (self.getparam('show_filter', 0) == 2):
         items = [item for item in items if abs(item.get_total()) > 0.0001]
     res = QuerySet(model=Third)
     res._result_cache = items
     return res
コード例 #3
0
 def get_items_from_filter(self):
     items = XferListEditor.get_items_from_filter(self)
     if notfree_mode_connect() and not self.request.user.is_superuser:
         new_items = []
         for item in items:
             item = item.get_final_child()
             if isinstance(item, DocumentContainer) or not item.cannot_view(
                     self.request.user):
                 new_items.append(item)
         items = QuerySet(model=AbstractContainer)
         items._result_cache = new_items
     return items
コード例 #4
0
ファイル: views.py プロジェクト: julienM77/syndic
 def get_items_from_filter(self):
     items = self.model.objects.annotate(completename=Concat('third__contact__individual__lastname', Value(' '), 'third__contact__individual__firstname')).filter(self.filter)
     sort_owner = self.getparam('GRID_ORDER%owner', '')
     sort_ownerbis = self.getparam('GRID_ORDER%owner+', '')
     self.params['GRID_ORDER%owner'] = ""
     if sort_owner != '':
         if sort_ownerbis.startswith('-'):
             sort_ownerbis = "+"
         else:
             sort_ownerbis = "-"
         self.params['GRID_ORDER%owner+'] = sort_ownerbis
     items = sorted(items, key=lambda t: six.text_type(t).lower(), reverse=sort_ownerbis.startswith('-'))
     res = QuerySet(model=Owner)
     res._result_cache = items
     return res
コード例 #5
0
def queryset_mock_factory(*args):
    """Creates a mock queryset with the given model instances"""
    queryset = QuerySet()
    queryset._result_cache = args
    return queryset
コード例 #6
0
def queryset_mock_factory(*args):
    """Creates a mock queryset with the given model instances"""
    queryset = QuerySet()
    queryset._result_cache = args
    return queryset