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


Python Page.confirmation_theme方法代码示例

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


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

示例1: get_delete

# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import confirmation_theme [as 别名]
    def get_delete(self, request, pk=None, do=False):
        from django.db.models import ProtectedError
        from .models import Users

        s = Auth().is_auth(request)
        if not s:
            return Auth.routeLogin

        self.second_base = 'users'

        self.model = Users

        try:
            instance = self.model.pp.get(pk=pk)
        except KeyError:
            return Auth.do_403()

        link = {
            'go': self.get_generic_link(self.second_base, "delete", "process", pk),
            'cancel': self.get_generic_link(self.second_base),
        }

        page = Page(request)
        page.confirmation_theme = "alert alert-dark"

        if not do:
            page.description = _('You are about to delete a user from your database <b>(%s)</b>. '
                                 'How do you want to proceed?').decode('UTF-8') % instance
            return render_to_response(request.session['style'] + '/layout/snippets/delete-confirmation.html',
                                      {'link': link, 'page': page}, context_instance=RequestContext(request))

        elif do:
            # prevents CASCADE DELETE from the model settings
            try:
                instance.delete()
                response = _("Personnel information was deleted successfully")
                style = 'info'
                route = link["cancel"]
                delay = 2000

            except ProtectedError:
                response = _("Cannot delete user, because other data keys are associated to these user "
                             "like organization information, hr_leave logs, training logs e.t.c.<br/>"
                             "However you can deactivate this user by clicking %s") % \
                           "<a ui-WitMVC-href href='#/system/user/deactivate/%s/'>%s</a>" % \
                           (instance.pk, _("here"))
                style = 'danger'
                delay = 15000
                route = None

            return HttpResponse(response_generic(route=route, response=response, delay=delay, style=style))
开发者ID:pukonu,项目名称:onc,代码行数:53,代码来源:controllers.py


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