xadmin+django2.0删除用户报错,get_deleted_objects() takes 3 positional arguments but 5 were given

解决方法:将xadmin/plugins/actions.py中的

        if django_version > (2, 0):
            #deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
               # queryset, self.opts, self.admin_site)
            using = router.db_for_write(self.model)
            deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
                 queryset, self.opts, self.user, self.admin_site, using)
        else:
            using = router.db_for_write(self.model)
            deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
                queryset, self.opts, self.user, self.admin_site, using)

改为

        if django_version > (2, 1):
            deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
                queryset, self.opts, self.admin_site)
            # using = router.db_for_write(self.model)
            # deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
            #     queryset, self.opts, self.user, self.admin_site, using)
        else:
            using = router.db_for_write(self.model)
            deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
                queryset, self.opts, self.user, self.admin_site, using)

 

posted @ 2018-11-21 20:30  雪落忆海  阅读(1351)  评论(0编辑  收藏  举报