• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python update_basket_task.delay函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mozillians.users.tasks.update_basket_task.delay函数的典型用法代码示例。如果您正苦于以下问题:Python delay函数的具体用法?Python delay怎么用?Python delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了delay函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_member

    def add_member(self, userprofile, status=GroupMembership.MEMBER):
        """
        Add a user to this group. Optionally specify status other than member.

        If user is already in the group with the given status, this is a no-op.

        If user is already in the group with a different status, their status will
        be updated.
        """
        defaults = dict(status=status, date_joined=now())
        membership, created = GroupMembership.objects.get_or_create(
            userprofile=userprofile, group=self, defaults=defaults
        )
        if created:
            if status == GroupMembership.MEMBER:
                # Joined
                update_basket_task.delay(userprofile.id)
        elif not created and membership.status != status:
            # Status changed
            old_status = membership.status
            membership.status = status
            membership.save()
            update_basket_task.delay(userprofile.id)
            if (old_status, status) == (GroupMembership.PENDING, GroupMembership.MEMBER):
                # Request accepted
                email_membership_change.delay(self.pk, userprofile.user.pk, old_status, status)
开发者ID:rahulrrixe,项目名称:mozillians,代码行数:26,代码来源:models.py


示例2: add_member

    def add_member(self, userprofile, status=GroupMembership.MEMBER):
        """
        Add a user to this group. Optionally specify status other than member.

        If user is already in the group with the given status, this is a no-op.

        If user is already in the group with a different status, their status will
        be updated if the change is a promotion. Otherwise, their status will not change.
        """
        defaults = dict(status=status,
                        date_joined=now())
        membership, created = GroupMembership.objects.get_or_create(userprofile=userprofile,
                                                                    group=self,
                                                                    defaults=defaults)
        if created:
            if status == GroupMembership.MEMBER:
                # Joined
                # Group is functional area, we want to sent this update to Basket
                if self.functional_area:
                    update_basket_task.delay(userprofile.id)
        else:
            if membership.status != status:
                # Status changed
                old_status = membership.status
                membership.status = status
                if (old_status, status) == (GroupMembership.PENDING, GroupMembership.MEMBER):
                    # Request accepted
                    membership.save()
                    if self.functional_area:
                        # Group is functional area, we want to sent this update to Basket.
                        update_basket_task.delay(userprofile.id)
                    email_membership_change.delay(self.pk, userprofile.user.pk, old_status, status)
开发者ID:Mauru,项目名称:mozillians,代码行数:32,代码来源:models.py


示例3: remove_member

 def remove_member(self, userprofile, send_email=True):
     membership = GroupMembership.objects.get(group=self, userprofile=userprofile)
     old_status = membership.status
     membership.delete()
     update_basket_task.delay(userprofile.id)
     if old_status == GroupMembership.PENDING and send_email:
         # Request denied
         email_membership_change.delay(self.pk, userprofile.user.pk, old_status, None)
开发者ID:rahulrrixe,项目名称:mozillians,代码行数:8,代码来源:models.py


示例4: toggle_group_subscription

def toggle_group_subscription(request, url):
    """Toggle the current user's membership of a group."""
    group = get_object_or_404(Group, url=url)
    profile = request.user.userprofile

    # We don't operate on system groups using this view.
    if not group.system:
        if profile.groups.filter(id=group.id).exists():
            profile.groups.remove(group)
        else:
            profile.groups.add(group)
        update_basket_task.delay(profile.id)

    return redirect(reverse('groups:show_group', args=[group.url]))
开发者ID:NightFury13,项目名称:mozillians,代码行数:14,代码来源:views.py


示例5: remove_member

    def remove_member(self, userprofile, send_email=True):
        try:
            membership = GroupMembership.objects.get(group=self, userprofile=userprofile)
        except GroupMembership.DoesNotExist:
            return
        old_status = membership.status
        membership.delete()

        # If group is functional area, we want to sent this update to Basket
        if self.functional_area:
            update_basket_task.delay(userprofile.id)

        if old_status == GroupMembership.PENDING and send_email:
            # Request denied
            email_membership_change.delay(self.pk, userprofile.user.pk,
                                          old_status, None)
开发者ID:WillsMcGarnigle,项目名称:mozillians,代码行数:16,代码来源:models.py


示例6: add_member

    def add_member(self, userprofile, status=GroupMembership.MEMBER):
        """
        Add a user to this group. Optionally specify status other than member.

        If user is already in the group with the given status, this is a no-op.

        If user is already in the group with a different status, their status will
        be updated if the change is a promotion. Otherwise, their status will not change.

        If the group in question is the NDA group, also add the user to the NDA newsletter.
        """
        defaults = dict(status=status, date_joined=now())
        membership, created = GroupMembership.objects.get_or_create(userprofile=userprofile,
                                                                    group=self,
                                                                    defaults=defaults)
        if membership.status != status:
            # Status changed
            # The only valid status change states are:
            # PENDING to MEMBER
            # PENDING to PENDING_TERMS
            # PENDING_TERMS to MEMBER

            old_status = membership.status
            membership.status = status
            statuses = [(GroupMembership.PENDING, GroupMembership.MEMBER),
                        (GroupMembership.PENDING, GroupMembership.PENDING_TERMS),
                        (GroupMembership.PENDING_TERMS, GroupMembership.MEMBER)]
            if (old_status, status) in statuses:
                # Status changed
                membership.save()
                if membership.status in [GroupMembership.PENDING, GroupMembership.MEMBER]:
                    email_membership_change.delay(self.pk, userprofile.user.pk, old_status, status)
                # Since there is no demotion, we can check if the new status is MEMBER and
                # subscribe the user to the NDA newsletter if the group is NDA
                if self.name == settings.NDA_GROUP and status == GroupMembership.MEMBER:
                    update_basket_task.delay(userprofile.id, [settings.BASKET_NDA_NEWSLETTER])
开发者ID:Acidburn0zzz,项目名称:mozillians,代码行数:36,代码来源:models.py


示例7: update_basket

def update_basket(sender, instance, **kwargs):
    update_basket_task.delay(instance.id)
开发者ID:jpotts,项目名称:mozillians,代码行数:2,代码来源:models.py


示例8: update_basket

def update_basket(sender, instance, **kwargs):
    if instance.is_vouched:
        update_basket_task.delay(instance.id)
    elif instance.basket_token:
        unsubscribe_from_basket_task.delay(instance.email, instance.basket_token)
开发者ID:Chaasof,项目名称:mozillians,代码行数:5,代码来源:models.py


示例9: update_basket

def update_basket(sender, instance, **kwargs):
    newsletters = [settings.BASKET_VOUCHED_NEWSLETTER]
    if instance.is_vouched:
        update_basket_task.delay(instance.id, newsletters)
    elif instance.basket_token:
        unsubscribe_from_basket_task.delay(instance.email, instance.basket_token, newsletters)
开发者ID:Acidburn0zzz,项目名称:mozillians,代码行数:6,代码来源:models.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.UserFactory类代码示例发布时间:2022-05-27
下一篇:
Python unindex_objects.delay函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap