当前位置: 首页>>代码示例>>Python>>正文


Python Email.delete方法代码示例

本文整理汇总了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')
开发者ID:Feanorka,项目名称:notify-io,代码行数:29,代码来源:main.py

示例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))
开发者ID:sonictt1,项目名称:material_game_store,代码行数:41,代码来源:views.py


注:本文中的models.Email.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。