當前位置: 首頁>>代碼示例>>Python>>正文


Python util.unquote方法代碼示例

本文整理匯總了Python中xadmin.util.unquote方法的典型用法代碼示例。如果您正苦於以下問題:Python util.unquote方法的具體用法?Python util.unquote怎麽用?Python util.unquote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xadmin.util的用法示例。


在下文中一共展示了util.unquote方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        "The 'delete' admin view for this model."
        self.obj = self.get_object(unquote(object_id))

        if not self.has_delete_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)})

        using = router.db_for_write(self.model)

        # Populate deleted_objects, a data structure of all related objects that
        # will also be deleted.
        (self.deleted_objects, model_count, self.perms_needed, self.protected) = get_deleted_objects(
            [self.obj], self.opts, self.request.user, self.admin_site, using) 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:18,代碼來源:delete.py

示例2: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        "The 'delete' admin view for this model."
        self.obj = self.get_object(unquote(object_id))

        if not self.has_delete_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)})

        using = router.db_for_write(self.model)

        # Populate deleted_objects, a data structure of all related objects that
        # will also be deleted.
        if django_version > (2, 1):
            (self.deleted_objects, model_count, self.perms_needed, self.protected) = get_deleted_objects(
                [self.obj], self.opts, self.admin_site)
        else:
            (self.deleted_objects, model_count, self.perms_needed, self.protected) = get_deleted_objects(
                [self.obj], self.opts, self.request.user, self.admin_site, using) 
開發者ID:Superbsco,項目名稱:weibo-analysis-system,代碼行數:22,代碼來源:delete.py

示例3: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        "The 'delete' admin view for this model."
        self.obj = self.get_object(unquote(object_id))

        if not self.has_delete_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_str(self.opts.verbose_name), 'key': escape(object_id)})

        using = router.db_for_write(self.model)

        # Populate deleted_objects, a data structure of all related objects that
        # will also be deleted.
        (self.deleted_objects, self.model_count, self.perms_needed, self.protected) = get_deleted_objects(
            [self.obj], self.opts, self.request.user, self.admin_site, using) 
開發者ID:madre,項目名稱:devops,代碼行數:18,代碼來源:delete.py

示例4: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        "The 'delete' admin view for this model."
        self.obj = self.get_object(unquote(object_id))

        if not self.has_delete_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_unicode(self.opts.verbose_name), 'key': escape(object_id)})

        using = router.db_for_write(self.model)

        # Populate deleted_objects, a data structure of all related objects that
        # will also be deleted.
        (self.deleted_objects, model_count, self.perms_needed, self.protected) = get_deleted_objects(
            [self.obj], self.opts, self.request.user, self.admin_site, using) 
開發者ID:Liweimin0512,項目名稱:ImitationTmall_Django,代碼行數:18,代碼來源:delete.py

示例5: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        self.obj = self.get_object(unquote(object_id))

        if not self.has_view_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') %
                          {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)}) 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:11,代碼來源:dashboard.py

示例6: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        self.obj = self.get_object(unquote(object_id))

        if not self.has_view_permission(self.obj):
            raise PermissionDenied

        if self.obj is None:
            raise Http404(
                _('%(name)s object with primary key %(key)r does not exist.') %
                {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)})
        self.org_obj = self.obj 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:13,代碼來源:detail.py

示例7: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        self.org_obj = self.get_object(unquote(object_id))

        if not self.has_change_permission(self.org_obj):
            raise PermissionDenied

        if self.org_obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') %
                          {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)})

        # comm method for both get and post
        self.prepare_form() 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:14,代碼來源:edit.py

示例8: get

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def get(self, request, object_id, *args, **kwargs):
        object_id = unquote(object_id)
        self.obj = self.get_object(object_id)

        if not self.has_change_permission(self.obj):
            raise PermissionDenied

        return self.get_response() 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:10,代碼來源:xversion.py

示例9: post

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def post(self, request, object_id):
        if not self.has_change_permission(request):
            raise PermissionDenied
        self.obj = self.get_object(unquote(object_id))
        self.form = self.change_password_form(self.obj, request.POST)

        if self.form.is_valid():
            self.form.save()
            self.message_user(_('Password changed successfully.'), 'success')
            return HttpResponseRedirect(self.model_admin_url('change', self.obj.pk))
        else:
            return self.get_response() 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:14,代碼來源:auth.py

示例10: init_request

# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import unquote [as 別名]
def init_request(self, object_id, *args, **kwargs):
        self.org_obj = self.get_object(unquote(object_id))

        # For list view get new field display html
        self.pk_attname = self.opts.pk.attname

        if not self.has_change_permission(self.org_obj):
            raise PermissionDenied

        if self.org_obj is None:
            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') %
                          {'name': force_text(self.opts.verbose_name), 'key': escape(object_id)}) 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:14,代碼來源:editable.py


注:本文中的xadmin.util.unquote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。