# Path: helper/models.py
# class DedupEvent(models.Model):
#     """
#     A simpler event type for when you just need to suppress duplicate
#     events by a simple unique key. For example, any facbeook event might be
#     stored for deduplication by it's FBID
#     """
#     task_pair = models.ForeignKey(TaskPair)
#     key = models.TextField()
#     created = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         unique_together = ('task_pair', 'key')
# 
#     def __str__(self):
#         return '{0.task_pair}::{0.key}'.format(self)


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

class Command(BaseCommand):
    help = 'Delete all DedupEvents 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 DedupEvent(models.Model):
#     """
#     A simpler event type for when you just need to suppress duplicate
#     events by a simple unique key. For example, any facbeook event might be
#     stored for deduplication by it's FBID
#     """
#     task_pair = models.ForeignKey(TaskPair)
#     key = models.TextField()
#     created = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         unique_together = ('task_pair', 'key')
# 
#     def __str__(self):
#         return '{0.task_pair}::{0.key}'.format(self)


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


class Command(BaseCommand):
    help = 'Delete all DedupEvents 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 = DedupEvent.objects.filter(task_pair_id=task_pair_id)