本文整理汇总了Python中models.Subscription.get_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Subscription.get_filter方法的具体用法?Python Subscription.get_filter怎么用?Python Subscription.get_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Subscription
的用法示例。
在下文中一共展示了Subscription.get_filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Subscription [as 别名]
# 或者: from models.Subscription import get_filter [as 别名]
def get(self, *args, **kwargs):
class_name=self.get_argument('class', None)
instance = self.get_argument('instance', "*")
recipient = self.get_argument('recipient', "*")
startdate = self.get_argument('startdate', "0") # change later to 2 weeks ago
enddate = self.get_argument('enddate', str(1000*2**35)) # if longpolling, should not have end date
longpoll = self.get_argument('longpoll', "False")
#TODO: do input validation on arguments
if class_name is not None:
sub = Subscription(class_name=class_name, instance=instance, recipient=recipient)
else:
sub = self.current_user
zephyrs = Zephyr.objects.filter(sub.get_filter(), date__gt=datetime.datetime.fromtimestamp(float(startdate)/1000),
date__lt=datetime.datetime.fromtimestamp(float(enddate)/1000))
if len(zephyrs) == 0 and longpoll.lower() == "true":
MessageWaitor.wait_for_messages(self,sub)
else:
self.write_zephyrs(zephyrs)