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


Python Organization.incidents方法代码示例

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


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

示例1: AuthenticatedPost

# 需要导入模块: from organization import Organization [as 别名]
# 或者: from organization.Organization import incidents [as 别名]
    def AuthenticatedPost(self, org, _):
        global_admin = False
        local_admin = False
        
        if org.name == GLOBAL_ADMIN_NAME:
            global_admin = True
        if org.is_admin == True and global_admin == False:
            local_admin = True
            
        if global_admin == False and local_admin == False:
            self.redirect("/")
            return

        # create form
        form = (
            GlobalAdminCreateOrganizationForm(self.request.POST) if global_admin
            else CreateOrganizationForm(self.request.POST)
        )
        events = self._get_events(org, global_admin, local_admin)
        form.incident.choices = [(str(event.key().id()), event.name) for event in events]

        if form.validate() and not form.errors:
            # create new org
            event = event_db.Event.get_by_id(int(form.incident.data))
            new_org = Organization(
                name=form.name.data,
            )
            new_org.incidents = [event.key()]
            new_org.save()
            del(form.incident)
            del(form.incidents)
            form.populate_obj(new_org)
            new_org.save()
            organization.PutAndCache(new_org)

            # redirect to the add contact page
            self.redirect('/admin-create-contact?selected_org=%d' % new_org.key().id())
        else:
            self.response.out.write(template.render({
                "form": form,
                "global_admin": global_admin,
            }))
开发者ID:aarontitus,项目名称:crisiscleanup-legacy,代码行数:44,代码来源:admin_create_organization_handler.py


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