本文整理汇总了Python中models.Notification.all方法的典型用法代码示例。如果您正苦于以下问题:Python Notification.all方法的具体用法?Python Notification.all怎么用?Python Notification.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Notification
的用法示例。
在下文中一共展示了Notification.all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def post(self):
notice_hash = self.request.path.split('/')[-1]
notice = Notification.all().filter('hash =', notice_hash).get()
target = Account.all().filter('api_key =', self.request.get('api_key')).get()
channel = notice.channel
if notice and channel.status == 'enabled' and channel.target.key() == target.key():
self.response.out.write(notice.dispatch())
else:
self.error(404)
示例2: get
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def get(self):
session = get_current_session()
if session.has_key('user'):
user = session['user']
page = helper.sanitizeHtml(self.request.get('pagina'))
perPage = 10
page = int(page) if page else 1
realPage = page - 1
inboxAll = True
if realPage > 0:
prevPage = realPage
if (page * perPage) < Notification.all().filter("target_user =",user).count():
nextPage = page + 1
notifications = Notification.all().filter("target_user =",user).order("-created").fetch(perPage,perPage * realPage)
prefetch.prefetch_refprops(notifications,Notification.post,Notification.comment,Notification.sender_user)
self.response.out.write(template.render('templates/notifications.html', locals()))
else:
self.redirect('/login')
示例3: post
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def post(self, hash):
hash = hash.lower()
notice = Notification.all().filter("hash =", hash).get()
target = Account.all().filter("api_key =", self.request.get("api_key")).get()
channel = notice.channel
if notice and channel.status == "enabled" and channel.target.key() == target.key():
notice.dispatch()
self.response.out.write("OK\n")
else:
self.error(404)
示例4: get
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def get(self):
user = users.get_current_user()
notifications_q = Notification.all().filter("user == ", user)\
.filter("read ==", False).order("-time")
notifications = []
for n in notifications_q:
try:
n.item_cl.title
except ReferencePropertyResolveError:
n.delete()
else:
notifications.append(n)
helpers.createResponse(self, 'notifications.html', {'notifications': notifications})
示例5: get
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def get(self):
user = users.get_current_user()
if not user:
uri = users.create_login_url('/')
self.redirect(uri)
return
template_values = {
'notifications': Notification.all().filter('owner = ', user),
'user': user
}
path = os.path.join(os.path.dirname(__file__), 'templates', 'index.html')
self.response.out.write(template.render(path, template_values))
示例6: get
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def get(self):
notifications = Notification.all().fetch(2000)
for notification in notifications:
taskqueue.add(url='/admin/delete-notification-of-deleted-comments', params={'notification_key': str(notification.key())})
示例7: delete
# 需要导入模块: from models import Notification [as 别名]
# 或者: from models.Notification import all [as 别名]
def delete(self):
notices = Notification.all().filter("channel =", self)
for n in notices:
n.channel = None
n.put()
super(Channel, self).delete()