uninstall.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:DjangoCMS 作者: farhan711 项目源码 文件源码
def handle_label(self, label, **options):
        plugin_pool.get_all_plugins()
        queryset = CMSPlugin.objects.filter(plugin_type=label)
        number_of_plugins = queryset.count()

        if number_of_plugins > 0:
            if options.get('interactive'):
                confirm = input("""
You have requested to remove %d %r plugins.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: """ % (number_of_plugins, label))
            else:
                confirm = 'yes'
            if confirm == 'yes':
                queryset.delete()
                self.stdout.write('%d %r plugins uninstalled\n' % (number_of_plugins, label))
            else:
                self.stdout.write('Aborted')
        else:
            self.stdout.write('no %r plugins found\n' % label)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号