本文整理汇总了Python中djblets.datagrid.grids.DataGrid.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DataGrid.__init__方法的具体用法?Python DataGrid.__init__怎么用?Python DataGrid.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类djblets.datagrid.grids.DataGrid
的用法示例。
在下文中一共展示了DataGrid.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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"]
示例2: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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
示例3: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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"
]
示例4: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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"]
示例5: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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"]
示例6: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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]
示例7: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
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"
]
示例8: __init__
# 需要导入模块: from djblets.datagrid.grids import DataGrid [as 别名]
# 或者: from djblets.datagrid.grids.DataGrid import __init__ [as 别名]
def __init__(self, request):
DataGrid.__init__(self, request, Group.objects.all(), "All Groups")
self.default_sort = []
self.default_columns = ['objid', 'name']