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


Python Contact.get_by_unique_id方法代码示例

本文整理汇总了Python中models.Contact.get_by_unique_id方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.get_by_unique_id方法的具体用法?Python Contact.get_by_unique_id怎么用?Python Contact.get_by_unique_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Contact的用法示例。


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

示例1: execute

# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import get_by_unique_id [as 别名]
    def execute(self):
        invite_attendee = None
        invite_attendee = InviteAttendee(
            unique_id=guid()
        )

        invite_attendee.name = self.name
        invite_attendee.email = self.email
        if self.status:
            invite_attendee.attendee_status = self.status
        invite_attendee.phone = self.phone

        if self.contact_unique_id:
            contact = Contact.get_by_unique_id(
                self.contact_unique_id
            )
            if contact:
                invite_attendee.contact = contact.key

        if not self.invite:
            self.invite = Invite.get_by_unique_id(self.invite_unique_id)
        invite_attendee.invite = self.invite.key

        invite_attendee.is_organizer = self.is_organizer

        if self.user:
            UpdateUserOnAttendeesCommand.update_user_on_attendee(self.user, invite_attendee)
        elif invite_attendee.email: # We can only correlate by email now
            user = self.user_from_email(invite_attendee.email)
            if user:
                UpdateUserOnAttendeesCommand.update_user_on_attendee(user, invite_attendee)

        invite_attendee.put()
        return invite_attendee.unique_id
开发者ID:xplot,项目名称:imeet,代码行数:36,代码来源:AddInviteAttendeeCommand.py

示例2: execute

# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import get_by_unique_id [as 别名]
    def execute(self):
        """
            This method adds all Contacts in a Group as Attendees to an Invite
            TODO: The way it' implemented it' extremely inefficient
        """

        commands = []

        contacts_in_group = GroupedContact.query(
            ndb.AND(
                GroupedContact.user == self.user.key,
                GroupedContact.group_unique_id == self.group_unique_id
        )).fetch()

        for x in contacts_in_group:
            contact = Contact.get_by_unique_id(x.contact_unique_id)

            commands.append(
                AddInviteAttendeeCommand(
                    invite_unique_id=self.invite_unique_id,
                    contact_unique_id=contact.unique_id,
                    name=contact.name,
                    email=contact.email,
                    phone=contact.phone
                )
            )

        return BulkAddInviteAttendeeCommand(
            self.invite_unique_id,
            commands
        ).execute()
开发者ID:xplot,项目名称:imeet,代码行数:33,代码来源:AddGroupAttendeesCommand.py

示例3: execute

# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import get_by_unique_id [as 别名]
    def execute(self):
        contact = None

        if self.unique_id:
            contact = Contact.get_by_unique_id(self.unique_id)
        else:
            contact = Contact(
                unique_id=guid()
            )

        contact.user = self.user
        contact.name = self.name
        contact.phone = self.phone
        contact.email = self.email

        contact.put()
        return contact.unique_id
开发者ID:xplot,项目名称:imeet,代码行数:19,代码来源:UpdateOrCreateContactCommand.py

示例4: execute

# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import get_by_unique_id [as 别名]
    def execute(self):
        invite_attendee = None
        if self.invite_attendee_id:
            invite_attendee = InviteAttendee.get_by_unique_id(self.invite_attendee_id)
        else:
            invite_attendee = InviteAttendee(
                unique_id=guid()
            )

        invite_attendee.name = self.name
        invite_attendee.email = self.email
        invite_attendee.phone = self.phone

        contact = None

        if self.user and self.unique_id:
            contact = Contact.get_by_unique_id(
                self.unique_id
            )

        elif self.user:
            contact = Contact(
                unique_id=guid(),
                user=self.user
            )

        # Here we update the contact with the appropiate Data
        if contact:
            invite_attendee.contact = contact.key
            contact.name = self.name
            contact.email = self.email
            contact.phone = self.phone
            contact.put()

        invite = Invite.get_by_unique_id(self.invite_id)
        invite_attendee.invite = invite.key

        invite_attendee.put()
        return invite_attendee.unique_id
开发者ID:xplot,项目名称:imeet,代码行数:41,代码来源:UpdateAttendeeAttachToContactCommand.py


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