本文整理汇总了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))