# Path: helper/models.py
# class Event(models.Model):
#     TASK_TYPE_CHOICES = [('cause',)*2, ('effect',)*2]
#     task_pair = models.ForeignKey('TaskPair')
#     task_type = models.CharField(max_length=255, choices=TASK_TYPE_CHOICES)
#     data = HStoreField()
#     created = models.DateTimeField(auto_now=True)
# 
#     def __str__(self):
#         return '{0.task_pair}::{0.task_type}'.format(self)


from django.core.management.base import BaseCommand, CommandError
from helper.models import Event

class Command(BaseCommand):
    help = 'Delete all Events for a particular task'

    def add_arguments(self, parser):
        parser.add_argument('task_pair_id', nargs='+', type=int)
        parser.add_argument('--no-op', action='store_true', help="dry run")

    def handle(self, *args, **options):
        for task_pair_id in options['task_pair_id']:

# Path: helper/models.py
# class Event(models.Model):
#     TASK_TYPE_CHOICES = [('cause',)*2, ('effect',)*2]
#     task_pair = models.ForeignKey('TaskPair')
#     task_type = models.CharField(max_length=255, choices=TASK_TYPE_CHOICES)
#     data = HStoreField()
#     created = models.DateTimeField(auto_now=True)
# 
#     def __str__(self):
#         return '{0.task_pair}::{0.task_type}'.format(self)


# Path: helper/management/commands/clear_events.py
from django.core.management.base import BaseCommand, CommandError
from helper.models import Event


class Command(BaseCommand):
    help = 'Delete all Events for a particular task'

    def add_arguments(self, parser):
        parser.add_argument('task_pair_id', nargs='+', type=int)
        parser.add_argument('--no-op', action='store_true', help="dry run")

    def handle(self, *args, **options):
        for task_pair_id in options['task_pair_id']:

            qs = Event.objects.filter(task_pair_id=task_pair_id)