Skip to content

Commit

Permalink
refs #938. Adds management command for deleting web harvests for a co…
Browse files Browse the repository at this point in the history
…llection.
  • Loading branch information
Justin Littman committed Jul 24, 2018
1 parent 16765f6 commit 60d6f53
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sfm/ui/management/commands/deletewebharvests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.core.management.base import BaseCommand
from ui.models import Harvest


class Command(BaseCommand):
help = 'Delete web harvests.'

def add_arguments(self, parser):
parser.add_argument('collection_id')

def handle(self, *args, **options):
for harvest in Harvest.objects.filter(harvest_type='web', collection__collection_id=options['collection_id']):
self.stdout.write('Deleting {}'.format(harvest.harvest_id))
harvest.delete()

0 comments on commit 60d6f53

Please sign in to comment.