本文整理匯總了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))