def handle_label(self, label, **options):
queryset = Page.objects.filter(application_urls=label)
number_of_apphooks = queryset.count()
if number_of_apphooks > 0:
if options.get('interactive'):
confirm = input("""
You have requested to remove %d %r apphooks.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: """ % (number_of_apphooks, label))
else:
confirm = 'yes'
if confirm == 'yes':
queryset.update(application_urls=None)
self.stdout.write('%d %r apphooks uninstalled\n' % (number_of_apphooks, label))
else:
self.stdout.write('no %r apphooks found\n' % label)
评论列表
文章目录