本文整理汇总了Python中tastypie.fields.BooleanField方法的典型用法代码示例。如果您正苦于以下问题:Python fields.BooleanField方法的具体用法?Python fields.BooleanField怎么用?Python fields.BooleanField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tastypie.fields
的用法示例。
在下文中一共展示了fields.BooleanField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_sorting
# 需要导入模块: from tastypie import fields [as 别名]
# 或者: from tastypie.fields import BooleanField [as 别名]
def apply_sorting(self, obj_list, options=None):
if options and "sort" in options:
if options['sort'] == 'showing':
return obj_list.order_by('-presenterdetail__showing')
else:
return obj_list.order_by(options['sort'])
return super(PresenterResource, self).apply_sorting(obj_list, options)
# showing = fields.BooleanField(readonly=True)
# def dehydrate_showing(self, bundle):
# print type(bundle.obj), type(bundle.data)
# print dir(type(bundle.obj))
# return bundle.obj.presenterdetail.showing
# def build_filters(self, filters=None):
# print filters
# if filters is None:
# filters = {}
# orm_filters = super(PresenterResource, self).build_filters(filters)
# print type(orm_filters), orm_filters
# if 'q' in filters:
# pass
# return orm_filters