本文整理汇总了Python中models.Email.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Email.delete方法的具体用法?Python Email.delete怎么用?Python Email.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Email
的用法示例。
在下文中一共展示了Email.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Email [as 别名]
# 或者: from models.Email import delete [as 别名]
def post(self):
action = self.request.get('action')
if action == 'reset':
self.account.set_hash_and_key()
elif action == 'addemail':
email = self.request.get('email')
if not Email.find_existing(email):
e = Email(email=self.request.get('email'), account=self.account)
e.send_activation_email()
e.put()
elif action == 'removeemail':
e = Email.get_by_id(int(self.request.get('email-id')))
if e.account.key() == self.account.key():
if e.hash() in self.account.hashes:
self.account.hashes.remove(e.hash())
self.account.put()
e.delete()
else:
if self.request.get('source_enabled', None):
self.account.source_enabled = True
self.account.source_name = self.request.get('source_name', None)
self.account.source_url = self.request.get('source_url', None)
self.account.source_icon = self.request.get('source_icon', None)
else:
self.account.source_enabled = False
self.account.put()
self.redirect('/settings')
示例2: index
# 需要导入模块: from models import Email [as 别名]
# 或者: from models.Email import delete [as 别名]
def index(request):
email = request.GET.get('email', False)
operation = request.GET.get('op', 'add')
order = request.GET.get('order', False)
if email:
if operation == 'add':
try:
email_model = Email(email=email)
email_model.save()
email = True
except IntegrityError:
pass
elif operation == 'remove':
try:
email_model = Email.objects.get(email=email)
email_model.delete()
email = True
except ObjectDoesNotExist:
pass
template = loader.get_template('store/game_list.html')
drm = request.GET.get('drm', None)
query = request.GET.get('query', None)
if order == 'new':
games = sorted(get_games_with_keys(drm=drm, query=query, new=True))
else:
games = sorted(get_games_with_keys(drm=drm, query=query))
context = {
'game_list': games,
'drm': drm,
'query': query,
'email_added': email,
'email_op': operation
}
return HttpResponse(template.render(context, request))