本文整理汇总了Python中packages.bin.bin.Page类的典型用法代码示例。如果您正苦于以下问题:Python Page类的具体用法?Python Page怎么用?Python Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ucp_flush
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'))
示例2: practitioner_delete
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
示例3: module_delete
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'))
示例4: cim_delete
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
示例5: UserResetPassword
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)
示例6: uc_user_delete
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'))
示例7: license_delete
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
示例8: UserDelete
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: subscription_delete
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'))
示例10: manifest_delete
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'))
示例11: get_delete
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: index
def index(request):
page = Page(request)
page.title = _('View Privileges')
page.icon = 'fa fa-key'
page.body_class = 'error-page sb-l-o sb-r-c'
template = "system/privilege/privileges.html"
return render_to_response(
template,
{'data': page},
context_instance=RequestContext(request)
)
示例13: email_view
def email_view(request, method=None):
page = Page(request)
page.title = _('Page Email Preview')
page.icon = 'glyphicons glyphicons-ban'
page.body_class = 'error-page sb-l-o sb-r-c'
template = "email/en-gb/%s.html" % method
return render_to_response(
template,
{'data': page},
context_instance=RequestContext(request)
)
示例14: asset
def asset(request, pk=None, method=None):
s = Auth().isAuth(request)
if not s:
return Auth.routeLogin
page = Page(request)
page.title = 'Assets'
page.icon = 'glyphicons glyphicons-display'
page.form_name = 'geoIndex'
template = 'asset.html'
page.body = '''
<iframe name='geo-map' src="/geo/" seamless='true' frameborder=0 scrolling='o'
height='100%' style='margin:-20px 0 0 -23px;'>
</iframe>
<script>
$(window).resize(function() {
resizeGeo();
});
function resizeGeo(){
var map = $("[name='geo-map']");
var x = map.offset().left;
var y = map.offset().top;
var windowW = $(window).width();
var windowH = $(window).height();
var newWidth = windowW - x;
var newHeight = windowH - y;
map.width(newWidth);
map.height(newHeight);
}
resizeGeo();
</script>
'''
# render to browser
return render_to_response(template,
{'s': s, 'page': page},
context_instance=RequestContext(request)
)
示例15: auth_error
def auth_error(request, error=None):
s = Auth().is_auth(request)
if not s:
return Auth.routeLogin
base_template = 'system/'
second_base = 'error/'
page = Page(request)
page.title = _('Page Error')
page.icon = 'glyphicons glyphicons-ban'
page.breadcrumbs = [_('System'), _('Page Error'), _(error)]
page.body_class = 'error-page sb-l-o sb-r-c'
try:
page.route_to = request.session['error-route']
except KeyError:
page.route_to = "/"
return render_to_response(
base_template+second_base+'%s.html' % error,
{'s': s, 'page': page},
context_instance=RequestContext(request)
)