当前位置: 首页>>代码示例>>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;未经允许,请勿转载。