当前位置: 首页>>代码示例>>Python>>正文


Python list.MultipleObjectMixin方法代码示例

本文整理汇总了Python中django.views.generic.list.MultipleObjectMixin方法的典型用法代码示例。如果您正苦于以下问题:Python list.MultipleObjectMixin方法的具体用法?Python list.MultipleObjectMixin怎么用?Python list.MultipleObjectMixin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.views.generic.list的用法示例。


在下文中一共展示了list.MultipleObjectMixin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_allow_future

# 需要导入模块: from django.views.generic import list [as 别名]
# 或者: from django.views.generic.list import MultipleObjectMixin [as 别名]
def get_allow_future(self):
        """
        Returns `True` if the view should be allowed to display objects from
        the future.
        """
        return self.allow_future

    # Note: the following three methods only work in subclasses that also
    # inherit SingleObjectMixin or MultipleObjectMixin. 
开发者ID:blackye,项目名称:luscan-devel,代码行数:11,代码来源:dates.py

示例2: get_datatable_kwargs

# 需要导入模块: from django.views.generic import list [as 别名]
# 或者: from django.views.generic.list import MultipleObjectMixin [as 别名]
def get_datatable_kwargs(self, **kwargs):
        queryset = self.get_queryset()
        kwargs.update({
            'object_list': queryset,
            'view': self,
            'model': self.model or queryset.model,
        })

        # This is, i.e., request, provided by default, but if the view is instantiated outside of the request cycle
        # (such as for the purposes of embedding that view's datatable elsewhere), the request may
        # not be required, so the user may not have a compelling reason to go through the trouble of
        # putting it on self.
        if hasattr(self, 'request'):
            kwargs['url'] = self.request.path
            kwargs['query_config'] = getattr(self.request, self.request.method)
        else:
            kwargs['query_config'] = {}

        settings = ('columns', 'exclude', 'ordering', 'start_offset', 'page_length', 'search',
                    'search_fields', 'unsortable_columns', 'hidden_columns', 'footer',
                    'structure_template', 'result_counter_id')

        for k in settings:
            v = getattr(self, k, None)
            if v is not None:  # MultipleObjectMixin or others might have default attr as None
                kwargs[k] = v
        return kwargs

    # Runtime per-object hook 
开发者ID:salopensource,项目名称:sal,代码行数:31,代码来源:base.py


注:本文中的django.views.generic.list.MultipleObjectMixin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。