# Path: profile/models.py
# class Notifications(models.Model):
#     update = models.BooleanField(default=True)
#     response = models.BooleanField(default=True)
#     reported = models.BooleanField(default=False)
#     threshold = models.BooleanField(default=False)
# 
# class Profile(models.Model):
#     user = models.OneToOneField(User, on_delete=models.CASCADE)
#     full_name = models.TextField()
#     notifications = models.ForeignKey('profile.Notifications', on_delete=models.CASCADE)
#     subscriptions = models.ManyToManyField('petitions.Petition', related_name='profile_subscriptions', blank=True)
#     petitions_created = models.ManyToManyField('petitions.Petition', related_name='profile_petitions_created', blank=True)
#     petitions_signed = models.ManyToManyField('petitions.Petition', related_name='profile_petitions_signed', blank=True)
#     display_name = models.CharField(max_length=3, blank=True)
#     # 0 - Does not have access, 1 - Has Access
#     has_access = models.PositiveSmallIntegerField(default=1)
# 
#     def __unicode__(self):
#         return self.user.username
# 
# Path: petitions/models.py
# class Petition(models.Model):
#     title = models.CharField(max_length=80)
#     description = models.TextField()
#     tags = models.ManyToManyField('petitions.Tag')
#     author = models.ForeignKey(User, on_delete=models.PROTECT)
#     signatures = models.PositiveIntegerField(default=0)
#     created_at = models.DateTimeField()
#     # These states include: 0 - new (unpublished), 1 - published, 2 - removed (unpublished), 3 - Needs Review
#     status = models.PositiveSmallIntegerField(default=0)
#     expires = models.DateTimeField()
#     last_signed = models.DateTimeField(default=None, blank=True, null=True)
#     has_response = models.BooleanField(default=False)
#     response = models.ForeignKey('petitions.Response', default=None, blank=True, null=True, on_delete=models.SET_NULL)
#     in_progress = models.NullBooleanField()
#     updates = models.ManyToManyField('petitions.Update', default=None)
#     old_id = models.CharField(max_length=20, default=None, blank=True, null=True)
# 
#     def __str__(self):
#         return self.title
# 
# class Tag(models.Model):
#     name = models.CharField(max_length=50)
# 
#     def __str__(self):
#         return self.name
# 
# class Response(models.Model):
#     description = models.TextField()
#     created_at = models.DateTimeField()
#     author = models.TextField()
# 
#     def __str__(self):
#         return self.author


import random
import traceback
from datetime import timedelta
from profile.models import Notifications, Profile
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db import transaction
from django.utils import timezone
from mimesis import Person, Text
from mimesis.enums import Gender
from petitions.models import Petition, Tag, Response
                    auth.save()

            self.stdout.write(self.style.SUCCESS(
                'Successfully set Petition relations'))
        except Exception as e:
            self.stdout.write(self.style.ERROR(
                'Failed to set relations %s' % e))
            print(traceback.format_exc())

    def generate_petitions(self, users, expired, unpub, removed, review, sigs, num_petitions, resp):
        petitionlst = []
        self.stdout.write('Generating Petition objects')
        text = Text('en')
        try:
            with transaction.atomic():
                for x in range(0, num_petitions):
                    # Generate/Grab data
                    num_sentences = random.randint(1, 10)
                    title = text.title()[0:80]
                    description = text.text(num_sentences)
                    author = random.choice(users)
                    if sigs:
                        signatures = sigs.pop()
                    else:
                        signatures = random.randint(1, len(users))
                    created_at = timezone.now() - timedelta(days=random.randint(0, 10))
                    status = 1
                    expires = created_at + timedelta(days=30)
                    last_signed = created_at + \
                        timedelta(days=random.randint(0, 10))

# Path: profile/models.py
# class Notifications(models.Model):
#     update = models.BooleanField(default=True)
#     response = models.BooleanField(default=True)
#     reported = models.BooleanField(default=False)
#     threshold = models.BooleanField(default=False)
# 
# class Profile(models.Model):
#     user = models.OneToOneField(User, on_delete=models.CASCADE)
#     full_name = models.TextField()
#     notifications = models.ForeignKey('profile.Notifications', on_delete=models.CASCADE)
#     subscriptions = models.ManyToManyField('petitions.Petition', related_name='profile_subscriptions', blank=True)
#     petitions_created = models.ManyToManyField('petitions.Petition', related_name='profile_petitions_created', blank=True)
#     petitions_signed = models.ManyToManyField('petitions.Petition', related_name='profile_petitions_signed', blank=True)
#     display_name = models.CharField(max_length=3, blank=True)
#     # 0 - Does not have access, 1 - Has Access
#     has_access = models.PositiveSmallIntegerField(default=1)
# 
#     def __unicode__(self):
#         return self.user.username
# 
# Path: petitions/models.py
# class Petition(models.Model):
#     title = models.CharField(max_length=80)
#     description = models.TextField()
#     tags = models.ManyToManyField('petitions.Tag')
#     author = models.ForeignKey(User, on_delete=models.PROTECT)
#     signatures = models.PositiveIntegerField(default=0)
#     created_at = models.DateTimeField()
#     # These states include: 0 - new (unpublished), 1 - published, 2 - removed (unpublished), 3 - Needs Review
#     status = models.PositiveSmallIntegerField(default=0)
#     expires = models.DateTimeField()
#     last_signed = models.DateTimeField(default=None, blank=True, null=True)
#     has_response = models.BooleanField(default=False)
#     response = models.ForeignKey('petitions.Response', default=None, blank=True, null=True, on_delete=models.SET_NULL)
#     in_progress = models.NullBooleanField()
#     updates = models.ManyToManyField('petitions.Update', default=None)
#     old_id = models.CharField(max_length=20, default=None, blank=True, null=True)
# 
#     def __str__(self):
#         return self.title
# 
# class Tag(models.Model):
#     name = models.CharField(max_length=50)
# 
#     def __str__(self):
#         return self.name
# 
# class Response(models.Model):
#     description = models.TextField()
#     created_at = models.DateTimeField()
#     author = models.TextField()
# 
#     def __str__(self):
#         return self.author


# Path: petitions/management/commands/mockdata.py
import random
import traceback
from datetime import timedelta
from profile.models import Notifications, Profile
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db import transaction
from django.utils import timezone
from mimesis import Person, Text
from mimesis.enums import Gender
from petitions.models import Petition, Tag, Response

                    auth.save()

            self.stdout.write(self.style.SUCCESS(
                'Successfully set Petition relations'))
        except Exception as e:
            self.stdout.write(self.style.ERROR(
                'Failed to set relations %s' % e))
            print(traceback.format_exc())

    def generate_petitions(self, users, expired, unpub, removed, review, sigs, num_petitions, resp):
        petitionlst = []
        self.stdout.write('Generating Petition objects')
        text = Text('en')
        try:
            with transaction.atomic():
                for x in range(0, num_petitions):
                    # Generate/Grab data
                    num_sentences = random.randint(1, 10)
                    title = text.title()[0:80]
                    description = text.text(num_sentences)
                    author = random.choice(users)
                    if sigs:
                        signatures = sigs.pop()
                    else:
                        signatures = random.randint(1, len(users))
                    created_at = timezone.now() - timedelta(days=random.randint(0, 10))
                    status = 1
                    expires = created_at + timedelta(days=30)
                    last_signed = created_at + \
                        timedelta(days=random.randint(0, 10))

                    petition = Petition()