本文整理汇总了Python中packages.bin.bin.Page.description方法的典型用法代码示例。如果您正苦于以下问题:Python Page.description方法的具体用法?Python Page.description怎么用?Python Page.description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packages.bin.bin.Page
的用法示例。
在下文中一共展示了Page.description方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: subscription_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def subscription_delete(request, pk=None, process=False):
# check if root login
if request.session['auth_username'] != 'root':
return HttpResponse(response_success(route='#hr/personnel/'))
base_url = '/pp-license/'
second_base = 'subscription/'
try:
instance = License.objects.get(pk=pk)
except KeyError:
return HttpResponseRedirect('#404/hack/')
link = {'go': base_url+second_base+'delete/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if not process:
page.description = 'Confirm delete request on a subscription period for <b>"%s"</b>' % instance.license
return render_to_response(request.session.style + '/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page}, context_instance=RequestContext(request))
elif process:
instance.delete()
return HttpResponse(response_success(route=base_url+second_base, response='Deleted successfully'))
示例2: uc_user_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def uc_user_delete(request, pk=None, process=False):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
second_base = 'user_class/'
try:
instance = UserClassTies.pp.get(pk=pk)
except KeyError:
return Auth.do_403()
link = {'go': base_url + 'uc_user-delete/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if not process:
page.description = 'Do you want to remove <b>%s [%s %s]</b> from the user class <b>%s</b>?' % \
(instance.user.username, instance.user.firstname, instance.user.lastname,
instance.user_class.name)
return render_to_response(request.session["style"]+'/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
instance.delete()
return HttpResponse(response_success(route=base_url+second_base, response='Removed Successfully'))
示例3: license_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def license_delete(request, pk=None):
# check if root login
if request.session['auth_username'] != 'root':
return HttpResponse(response_success(route='#hr/personnel/'))
base_url = '/pp-license/'
second_base = 'delete/'
try:
instance = License.objects.get(pk=pk)
except KeyError:
return HttpResponseRedirect('#404/hack/')
link = {'go': base_url+'delete/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if request.GET.get("license") is None:
page.description = _('You are about to delete a license <b>%s</b>. This action cannot be reversed, '
'to delete a license you must use querystring comman') % instance
return render_to_response(request.session.style + '/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page}, context_instance=RequestContext(request))
else:
from packages.system.models import Users
from packages.hr.hr_personnel.models import Basic
if request.GET.get("license") == "root_delete":
# delete all occurrences from database
pass
示例4: manifest_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def manifest_delete(request, pk=None, process=False):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
second_base = 'manifest/'
try:
instance = PrivilegeManifest.objects.get(pk=pk)
except KeyError:
return Auth.do_403()
link = {'go': base_url + 'manifest-delete/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if not process:
page.description = 'You are about to delete a user class from %s module <b>[%s]</b>. ' \
'How do you want to proceed?' % (instance.module.name, instance.name)
return render_to_response(request.session["style"]+'/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
"""Check if there a privileges associated with this manifest"""
item_count = instance.manifest_privilege.all().count()
print item_count
if item_count > 0:
return HttpResponse(response_error(response="You need to delete all associated privileges before deleting "
"privilege manifest."))
else:
instance.delete()
return HttpResponse(response_success(route=base_url+second_base, response='Deleted successfully'))
示例5: ucp_flush
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def ucp_flush(request, pk=None, process=False):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
second_base = 'user_class/'
try:
instance = Privilege.objects.get(pk=pk)
except KeyError:
return Auth.do_403()
link = {'go': base_url + 'flush/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if not process:
page.description = 'Do you want to delete the grant <b>%s</b> from <b>%s</b> user class category?' % \
(instance.manifest, instance.user_class.name)
return render_to_response(request.session["style"]+'/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
instance.delete()
return HttpResponse(response_success(route=base_url+second_base, response='Privilege was flushed'))
示例6: module_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def module_delete(request, pk=None, process=False):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
second_base = 'module/'
try:
instance = Module.objects.get(pk=pk)
except KeyError:
return Auth.do_403()
link = {'go': base_url + 'module-delete/process/'+str(pk)+'/', 'cancel': base_url+second_base}
page = Page(request)
if not process:
page.description = 'You are about to delete an application module <b>[%s]</b>. How do you want to proceed?' \
% instance.name
return render_to_response(request.session["style"]+'/layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
instance.delete()
return HttpResponse(response_success(route=base_url+second_base, response='Deleted successfully'))
示例7: UserResetPassword
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def UserResetPassword(request, pk=None, process=False):
s = Auth().isAuth(request)
if s is False:
return Auth.routeLogin
second_base_url = ''
try:
obj = Users.objects.get(pk=pk)
except KeyError:
return HttpResponseRedirect('/404/hack/')
link = {
'go': base_url_admin+second_base_url+'reset-password/process/'+str(pk)+'/',
'cancel': base_url_admin+second_base_url
}
page = Page(request)
page.confirmation_value = "Reset Password"
if not process:
page.description = 'You are about to reset <b>%s</b>\'s password. How do you want to proceed?' % obj.username
return render_to_response(
'layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
obj.password = sha1("password").hexdigest()
obj.save()
return HttpResponseRedirect(base_url_admin+second_base_url)
示例8: UserDelete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def UserDelete(request, pk=None, process=False):
s = Auth().isAuth(request)
if s is False:
return Auth.routeLogin
second_base_url = ''
try:
obj = Users.objects.get(pk=pk)
except KeyError:
return HttpResponseRedirect('/404/hack/')
link = {
'go': base_url_admin+second_base_url+'delete/process/'+str(pk)+'/',
'cancel': base_url_admin+second_base_url
}
page = Page(request)
if not process:
page.description = 'You are about to delete a user: <b>%s</b>. How do you want to proceed?' % obj.username
return render_to_response(
'layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
# delete user details
obj.delete()
return HttpResponseRedirect(base_url_admin+second_base_url)
示例9: cim_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def cim_delete(request, pk=None, process=False):
s = Auth().isAuth(request)
if not s:
return Auth.routeLogin
second_base = 'cim/'
try:
instance = CIM.objects.get(pk=pk)
except KeyError:
HttpResponseRedirect('/404/hack/')
link = {'go':base_url + second_base + 'delete/process/'+str(pk)+'/', 'cancel':base_url}
page = Page(request)
if not process:
page.description = 'You are about to delete <b>"%s"</b> from your customer record. How do you want to proceed?' % instance
return render_to_response('layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
if True:
instance.delete()
return HttpResponseRedirect(base_url + second_base)
else:
pass
示例10: practitioner_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def practitioner_delete(request, pk=None, process=False):
s = Auth().isAuth(request)
if not s:
return Auth.routeLogin
second_base = 'index/'
try:
instance = Practitioner.objects.get(pk=pk)
except KeyError:
HttpResponseRedirect('/404/hack/')
link = {'go':base_url + 'delete/process/'+str(pk)+'/', 'cancel':base_url + second_base}
page = Page(request)
if not process:
page.description = 'You are about to delete <b>"%s"</b> from your practitioners record, all accompanying assets' \
' for %s will also be deleted. How do you want to proceed?' % (instance, instance)
return render_to_response('layout/snippets/delete-confirmation.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif process:
if True:
instance.delete()
return HttpResponseRedirect(base_url + second_base)
else:
pass
示例11: get_delete
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [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))
示例12: get_reset_password
# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import description [as 别名]
def get_reset_password(self, request, pk=None, do=None):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
from packages.bin.bin import get_company
second_base_url = ''
try:
obj = self.model.pp.get(pk=pk)
except KeyError:
return HttpResponseRedirect('#404/hack/')
link = {'go': self.base_url+second_base_url+'reset-password/process/'+str(pk)+'/',
'cancel': self.base_url+second_base_url}
page = Page(request)
page.confirmation_value = "Reset Password"
if not do:
page.description = 'You are about to reset <b>%s</b>\'s password. How do you want to proceed?' % obj.email
return render_to_response(
request.session['style'] + '/layout/snippets/delete-confirmation-modal.html',
{'link': link, 'page': page},
context_instance=RequestContext(request)
)
elif do:
from packages.bin.email import Email
# send mail
company = get_company(user=obj)
raw_password = obj.reset_password()
data = dict()
data['request'] = request
data['password'] = "%s: <strong>%s</strong>" % (_("New Password"), raw_password)
data['company'] = company
try:
data['logo'] = company.company_logo_raw.url
except (AttributeError, ValueError):
data['logo'] = None
data['email'] = obj.email
data['link'] = "/system/login/"
data['title'] = _("Password Reset")
data['info'] = \
_("Hi <strong>%s</strong>, your password for PostPrincipal ERP Ontogeny was reset "
"successfully, to login please use the temporary generated password below") % \
obj.profile.get_fullname()
subject = _("Password Reset Confirmation - %s" % company.company_name)
email_object = Email(
request, to=[obj.email], subject=subject, data=data
)
email_object.email_template = "system/email/reset-password.html"
email_object.auth_email = company.auth_email
email_object.auth_password = company.auth_password
email_object.smtp_host = company.smtp_host
email_object.smtp_port = company.smtp_port
email_object.use_tls = company.use_tls
email_object.send()
# notify user of success
msg = _("User password was reset successfully")
return HttpResponse(response_success(route='/system/users/', response=msg))