python类ListView()的实例源码

views.py 文件源码 项目:extractfacts 作者: oneroyalace 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def get_table_pagination(self, table):
        '''
        Returns pagination options: True for standard pagination (default),
        False for no pagination, and a dictionary for custom pagination.
        '''
        paginate = self.table_pagination

        if hasattr(self, 'paginate_by') and self.paginate_by is not None:
            # Since ListView knows the concept paginate_by, we use that if no
            # other pagination is configured.
            paginate = paginate or {}
            paginate['per_page'] = self.paginate_by

        if paginate is None:
            return True

        return paginate
views.py 文件源码 项目:extractfacts 作者: oneroyalace 项目源码 文件源码 阅读 67 收藏 0 点赞 0 评论 0
def get_table_pagination(self, table):
        '''
        Returns pagination options: True for standard pagination (default),
        False for no pagination, and a dictionary for custom pagination.
        '''
        paginate = self.table_pagination

        if hasattr(self, 'paginate_by') and self.paginate_by is not None:
            # Since ListView knows the concept paginate_by, we use that if no
            # other pagination is configured.
            paginate = paginate or {}
            paginate['per_page'] = self.paginate_by

        if paginate is None:
            return True

        return paginate
CRUD.py 文件源码 项目:djreservation 作者: luisza 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def get_list_view_class(self):
        class UListView(ListView):

            def get_queryset(self):
                queryset = super(UListView, self).get_queryset()
                queryset = queryset.filter(user=self.request.user)
                return queryset
        return UListView
nodes.py 文件源码 项目:djunin 作者: ercpe 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_queryset(self):
        logger.debug("Filter by category: %s", self.current_category)
        q = super(ListView, self).get_queryset().\
            filter(node=self.node, graph_category=self.current_category)

        if not self.subgraph:
            q = q.filter(parent=None)

        if self.graph:
            logger.debug("Filter by graph: %s", self.graph)
            q = q.filter(pk=self.graph.pk)

        q = q.select_related('node').order_by('graph_category', 'name')

        return self.model.objects.munin_ordered(q)


问题


面经


文章

微信
公众号

扫码关注公众号