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


Python grids.DataGrid类代码示例

本文整理汇总了Python中djblets.datagrid.grids.DataGrid的典型用法代码示例。如果您正苦于以下问题:Python DataGrid类的具体用法?Python DataGrid怎么用?Python DataGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, *args, **kwargs):
        self.local_site = kwargs.pop('local_site', None)

        if self.local_site:
            review_id_field = 'local_id'
        else:
            review_id_field = 'pk'

        self.review_id = Column(_("Review ID"),
                                field_name=review_id_field,
                                shrink=True, sortable=True, link=True)

        DataGrid.__init__(self, *args, **kwargs)
        self.listview_template = 'reviews/review_request_listview.html'
        self.profile_sort_field = 'sort_review_request_columns'
        self.profile_columns_field = 'review_request_columns'
        self.show_submitted = True
        self.submitter_url_name = "user"
        self.default_sort = ["-last_updated"]
        self.default_columns = [
            "star", "summary", "submitter", "time_added", "last_updated_since"
        ]

        # Add local timezone info to the columns
        user = self.request.user
        if user.is_authenticated():
            self.timezone = pytz.timezone(user.get_profile().timezone)
            self.time_added.timezone = self.timezone
            self.last_updated.timezone = self.timezone
            self.diff_updated.timezone = self.timezone
开发者ID:JustinTulloss,项目名称:reviewboard,代码行数:30,代码来源:datagrids.py

示例2: __init__

 def __init__(self, request,
              queryset=Matos.objects.all(),
              title="Tout le matos"):
     DataGrid.__init__(self, request, queryset, title)
     self.show_disabled = False
     self.default_sort = ["titre"]
     self.default_columns = ["titre", "prix", "date_achat", "categorie"]
开发者ID:cattias,项目名称:cannesalair,代码行数:7,代码来源:datagrids.py

示例3: __init__

 def __init__(self, request, title=_("All groups"), *args, **kwargs):
     DataGrid.__init__(self, request, queryset=Group.objects.all(),
                       title=title, *args, **kwargs)
     self.profile_sort_field = 'sort_group_columns'
     self.profile_columns_field = 'group_columns'
     self.default_sort = ["name"]
     self.default_columns = [
         "star", "name", "displayname", "pending_count"
     ]
开发者ID:obvio171,项目名称:reviewboard,代码行数:9,代码来源:datagrids.py

示例4: __init__

    def __init__(self, request, title=_("All groups"), *args, **kwargs):
        local_site = kwargs.pop("local_site", None)
        queryset = Group.objects.accessible(request.user, local_site=local_site)

        DataGrid.__init__(self, request, queryset=queryset, title=title, *args, **kwargs)
        self.profile_sort_field = "sort_group_columns"
        self.profile_columns_field = "group_columns"
        self.default_sort = ["name"]
        self.default_columns = ["star", "name", "displayname", "pending_count"]
开发者ID:emou,项目名称:reviewboard,代码行数:9,代码来源:datagrids.py

示例5: __init__

 def __init__(self, *args, **kwargs):
     self.local_site = kwargs.pop("local_site", None)
     DataGrid.__init__(self, *args, **kwargs)
     self.listview_template = "reviews/review_request_listview.html"
     self.profile_sort_field = "sort_review_request_columns"
     self.profile_columns_field = "review_request_columns"
     self.show_submitted = True
     self.submitter_url_name = "user"
     self.default_sort = ["-last_updated"]
     self.default_columns = ["star", "summary", "submitter", "time_added", "last_updated_since"]
开发者ID:philipphenkel,项目名称:post-reviewboard,代码行数:10,代码来源:datagrids.py

示例6: setUp

    def setUp(self):
        super(SandboxTests, self).setUp()

        self.column = SandboxColumn(id='test')
        DataGrid.add_column(self.column)

        self.factory = RequestFactory()
        self.request = self.factory.get('test', {'columns': 'objid'})
        self.request.user = User(username='reviewboard', email='',
                                 password='password')
        self.datagrid = DataGrid(request=self.request,
                                 queryset=Group.objects.all())
开发者ID:CptJason,项目名称:djblets,代码行数:12,代码来源:tests.py

示例7: SandboxTests

class SandboxTests(SpyAgency, TestCase):
    """Testing extension sandboxing."""
    def setUp(self):
        super(SandboxTests, self).setUp()

        self.column = SandboxColumn(id='test')
        DataGrid.add_column(self.column)

        self.factory = RequestFactory()
        self.request = self.factory.get('test', {'columns': 'objid'})
        self.request.user = User(username='reviewboard', email='',
                                 password='password')
        self.datagrid = DataGrid(request=self.request,
                                 queryset=Group.objects.all())

    def tearDown(self):
        super(SandboxTests, self).tearDown()

        DataGrid.remove_column(self.column)

    def test_setup_state_columns(self):
        """Testing DataGrid column sandboxing for setup_state"""
        self.spy_on(SandboxColumn.setup_state)

        self.datagrid.get_stateful_column(column=self.column)
        self.assertTrue(SandboxColumn.setup_state.called)

    def test_get_sort_field_columns(self):
        """Testing DataGrid column sandboxing for get_sort_field"""
        self.datagrid.sort_list = ['test']
        self.datagrid.default_columns = ['objid', 'test']

        self.spy_on(SandboxColumn.get_sort_field)

        self.assertRaisesMessage(
            FieldError,
            "Invalid order_by arguments: [u'']",
            lambda: self.datagrid.precompute_objects())
        self.assertTrue(SandboxColumn.get_sort_field.called)

    def test_render_data_columns(self):
        """Testing DataGrid column sandboxing for render_data"""
        stateful_column = self.datagrid.get_stateful_column(column=self.column)

        self.spy_on(SandboxColumn.render_data)

        super(SandboxColumn, self.column).render_cell(state=stateful_column,
                                                      obj=None,
                                                      render_context=None)
        self.assertTrue(SandboxColumn.render_data.called)

    def test_augment_queryset_columns(self):
        """Testing DataGrid column sandboxing for augment_queryset"""
        stateful_column = self.datagrid.get_stateful_column(column=self.column)
        self.datagrid.columns.append(stateful_column)

        self.spy_on(SandboxColumn.augment_queryset)

        self.datagrid.post_process_queryset(queryset=[])
        self.assertTrue(SandboxColumn.augment_queryset.called)
开发者ID:CptJason,项目名称:djblets,代码行数:60,代码来源:tests.py

示例8: __init__

    def __init__(self, request):
        sel_common = "SELECT COUNT(*) FROM plug_uris_uri WHERE"
        sql_table_join = "AND uri_source=plug_uris_urisource.id"

        sql_img_ok = "%s status=%i %s" % (sel_common, models.URIS_COMPLETED, sql_table_join)
        sql_img_waiting = "%s status=%i AND item_type=%i AND err_code=%i %s" % (
            sel_common, models.URIS_CREATED, models.URIT_OBJECT, models.URIE_NO_ERROR, sql_table_join)
        sql_img_bad = "%s err_code > %i %s" % (sel_common, models.URIE_NO_ERROR, sql_table_join)

        sql = "SELECT task_eta FROM process_monitor_processmonitoring where pid=plug_uris_urisource.pid"
        DataGrid.__init__(self, request,
                          models.UriSource.objects.extra(select={
                              'imgs_ok':sql_img_ok,
                              #'imgs_bad': sql_img_bad,
                              'imgs_waiting':sql_img_waiting,
                              #'eta':sql,
                              }), "Uri sources")
        #DataGrid.__init__(self, request, User.objects.filter(is_active=True), "Users")
        self.default_sort = [COL_NAME]
        self.default_columns = [COL_NAME, COL_WAITING, COL_OK, COL_BAD]
开发者ID:europeana,项目名称:tools,代码行数:20,代码来源:datagrids.py

示例9: __init__

    def __init__(self, *args, **kwargs):
        self.local_site = kwargs.pop('local_site', None)

        if self.local_site:
            review_id_field = 'local_id'
        else:
            review_id_field = 'pk'

        self.review_id = Column(_("Review ID"),
                                field_name=review_id_field,
                                shrink=True, sortable=True, link=True)

        DataGrid.__init__(self, *args, **kwargs)
        self.listview_template = 'reviews/review_request_listview.html'
        self.profile_sort_field = 'sort_review_request_columns'
        self.profile_columns_field = 'review_request_columns'
        self.show_submitted = True
        self.submitter_url_name = "user"
        self.default_sort = ["-last_updated"]
        self.default_columns = [
            "star", "summary", "submitter", "time_added", "last_updated_since"
        ]
开发者ID:aineko,项目名称:reviewboard,代码行数:22,代码来源:datagrids.py

示例10: __init__

 def __init__(self, request):
     DataGrid.__init__(self, request, Group.objects.all(), "All Groups")
     self.default_sort = []
     self.default_columns = ['objid', 'name']
开发者ID:Harikanrh,项目名称:djblets,代码行数:4,代码来源:tests.py

示例11: tearDown

    def tearDown(self):
        super(SandboxTests, self).tearDown()

        DataGrid.remove_column(self.column)
开发者ID:CptJason,项目名称:djblets,代码行数:4,代码来源:tests.py


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