當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。