# Path: txqueue/models.py
# class QueuedTier(models.Model):
#     name = models.CharField(max_length=255)
#     url = models.CharField(max_length=2048)
#     starts = models.DateTimeField()
#     ends = models.DateTimeField(null=True, blank=True)
#     max_active = models.IntegerField(default=0)
#     max_tickets = models.IntegerField(default=4)
#     cap = models.IntegerField(default=0)
#     average_tickets = models.DecimalField(default=0, max_digits=6,
#             decimal_places=2)
#     ticket_count_ready = models.IntegerField(default=0)
#     ticket_count_started = models.IntegerField(default=0)
#     ticket_count_finished = models.IntegerField(default=0)
#     ticket_count_paid = models.IntegerField(default=0)


from django.core.management.base import NoArgsCommand, BaseCommand
from optparse import make_option
from txqueue.models import QueuedTier
from datetime import datetime
import random
import string

class Command(BaseCommand):
    args = "<name url start_date start_time max_tickets cap>"
    help = "Create a new queued tier"

    def handle(self, *args, **options):
        name = args[0]
        url = args[1]
        starts = datetime.strptime(args[2]+' '+args[3], "%Y-%m-%d %H:%M:%S")
        max_tickets = int(args[4])
        cap = int(args[5])


# Path: txqueue/models.py
# class QueuedTier(models.Model):
#     name = models.CharField(max_length=255)
#     url = models.CharField(max_length=2048)
#     starts = models.DateTimeField()
#     ends = models.DateTimeField(null=True, blank=True)
#     max_active = models.IntegerField(default=0)
#     max_tickets = models.IntegerField(default=4)
#     cap = models.IntegerField(default=0)
#     average_tickets = models.DecimalField(default=0, max_digits=6,
#             decimal_places=2)
#     ticket_count_ready = models.IntegerField(default=0)
#     ticket_count_started = models.IntegerField(default=0)
#     ticket_count_finished = models.IntegerField(default=0)
#     ticket_count_paid = models.IntegerField(default=0)


# Path: txqueue/management/commands/txqueue_create_tier.py
from django.core.management.base import NoArgsCommand, BaseCommand
from optparse import make_option
from txqueue.models import QueuedTier
from datetime import datetime
import random
import string


class Command(BaseCommand):
    args = "<name url start_date start_time max_tickets cap>"
    help = "Create a new queued tier"

    def handle(self, *args, **options):
        name = args[0]
        url = args[1]
        starts = datetime.strptime(args[2]+' '+args[3], "%Y-%m-%d %H:%M:%S")
        max_tickets = int(args[4])
        cap = int(args[5])


        tier = QueuedTier(name=name, url=url, starts=starts,