from django.db import models
from django.utils.html import mark_safe, strip_tags
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.core.exceptions import ValidationError
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.conf import settings
from django.contrib.auth.hashers import get_hasher
from django.db import transaction
from django.urls import reverse
from django.db.models import Q


from tinymce import models as tinymce_models
from colorfield.fields import ColorField

import html


class Petition(models.Model):

    NO =           "no gradient"
    RIGHT =        "to right"
    BOTTOM =       "to bottom"
    BOTTOM_RIGHT = "to bottom right"
    BOTTOM_LEFT =  "to bottom left"

    LINEAR_GRADIENT_CHOICES = (
        (NO,           "no gradient"),
        (RIGHT,        "to right"),
        (BOTTOM,       "to bottom"),
        (BOTTOM_RIGHT, "to bottom right"),
        (BOTTOM_LEFT,  "to bottom left")
    )

    MAIL = "MAIL"
    POST = "POST"
    GET = "GET"

    NEWSLETTER_SUBSCRIBE_METHOD_CHOICES = (
        (MAIL, "MAIL"),
        (POST, "POST"),
        (GET,  "GET")
    )

    title = models.TextField(verbose_name=ugettext_lazy("Title"))
    text = tinymce_models.HTMLField(blank=True)
    side_text = tinymce_models.HTMLField(blank=True)
    target = models.IntegerField(default=500)
    linear_gradient_direction = models.CharField(choices=LINEAR_GRADIENT_CHOICES, max_length=15, default=NO, blank=True)
    gradient_from = ColorField(blank=True)
    gradient_to = ColorField(blank=True)
    bgcolor = ColorField(blank=True)
    footer_text = tinymce_models.HTMLField(blank=True)
    footer_links = tinymce_models.HTMLField(blank=True)
    twitter_description = models.CharField(max_length=200, blank=True)
    twitter_image = models.CharField(max_length=500, blank=True)
    has_newsletter = models.BooleanField(default=False)
    newsletter_subscribe_http_data = models.TextField(blank=True)
    newsletter_subscribe_http_mailfield = models.CharField(max_length=100, blank=True)
    newsletter_subscribe_http_url = models.CharField(max_length=1000, blank=True)
    newsletter_subscribe_mail_subject = models.CharField(max_length=1000, blank=True)
    newsletter_subscribe_mail_from = models.CharField(max_length=500, blank=True)
    newsletter_subscribe_mail_to = models.CharField(max_length=500, blank=True)
    newsletter_subscribe_method = models.CharField(choices=NEWSLETTER_SUBSCRIBE_METHOD_CHOICES, max_length=4,
                                                   default=MAIL)
    newsletter_subscribe_mail_smtp_host = models.CharField(max_length=100, default='localhost', blank=True)
    newsletter_subscribe_mail_smtp_port = models.IntegerField(default=25, blank=True)
    newsletter_subscribe_mail_smtp_user = models.CharField(max_length=200, blank=True)
    newsletter_subscribe_mail_smtp_password = models.CharField(max_length=200, blank=True)
    newsletter_subscribe_mail_smtp_tls = models.BooleanField(default=False)
    newsletter_subscribe_mail_smtp_starttls = models.BooleanField(default=False)
    org_twitter_handle = models.CharField(max_length=20, blank=True)
    published = models.BooleanField(default=False)
    newsletter_text = models.CharField(max_length=1000, blank=True)
    sign_form_footer = models.TextField(blank=True)
    confirmation_email_sender = models.CharField(max_length=100, blank=True)
    confirmation_email_smtp_host = models.CharField(max_length=100, default='localhost', blank=True)
    confirmation_email_smtp_port = models.IntegerField(default=25, blank=True)
    confirmation_email_smtp_user = models.CharField(max_length=200, blank=True)
    confirmation_email_smtp_password = models.CharField(max_length=200, blank=True)
    confirmation_email_smtp_tls = models.BooleanField(default=False)
    confirmation_email_smtp_starttls = models.BooleanField(default=False)
    use_custom_email_settings = models.BooleanField(default=False)
    salt = models.TextField(blank=True)
    slugs = models.ManyToManyField('SlugModel', blank=True, through='SlugOwnership')


    def prepopulate_from_template(self, template):
        for field in self._meta.fields:
            if hasattr(self, field.name) and hasattr(template, field.name):
                template_value = getattr(template, field.name)
                if template_value is not None and template_value != "":
                    setattr(self, field.name, template_value)

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        if not self.salt:
            hasher = get_hasher()
            self.salt = hasher.salt().decode('utf-8')
            super().save()

    def slugify(self):
        if self.slugs.count() == 0:
            slugtext = slugify(self.raw_title)
            # let's search for slug collisions
            filters = {'slugs__slug': slugtext}
            if self.organization_set.count() > 0:
                org = self.organization_set.first()
                filters.update({'organization__name': org.name})
            else:
                user = self.pytitionuser_set.first()
                filters.update({'pytitionuser__user__username': user.user.username})
            results = Petition.objects.filter(**filters)
            if results.count() > 0:
                raise ValueError(_("This slug is already used by another petition from this organization/user"))

            slug = SlugModel(slug=slugify(slugtext))
            slug.save()
            self.slugs.add(slug)
            self.save()


    @classmethod
    def by_id(cls, id):
        try:
            return Petition.objects.get(pk=id)
        except Petition.DoesNotExist:
            return None

    def get_signature_number(self, confirmed=None):
        signatures = self.signature_set
        if confirmed is not None:
            signatures = signatures.filter(confirmed=confirmed)
        return signatures.count()

    def already_signed(self, email):
        signature_number = Signature.objects.filter(petition = self.id)\
            .filter(confirmed = True).filter(email = email).count()
        return signature_number > 0

    def confirm_signature(self, conf_hash):
        signature = Signature.objects.filter(petition=self.id).get(confirmation_hash=conf_hash)
        if signature:
            # Now confirm the signature corresponding to this hash
            signature.confirm()
            signature.save()
            return _("Thank you for confirming your signature!")
        else:
            return None

    def add_slug(self, slugtext):
        with transaction.atomic():
            slugtext = slugify(slugtext)
            slug = SlugModel.objects.create(slug=slugtext)
            if self.owner_type == "org":
                SlugOwnership.objects.create(slug=slug, petition=self, organization=self.owner)
            elif self.owner_type == "user":
                SlugOwnership.objects.create(slug=slug, petition=self, user=self.owner)
            else:
                raise ValueError(_("This petition has no owner, cannot add slug!"))

    def del_slug(self, slug):
        slug.delete()

    def publish(self):
        self.published = True
        self.save()

    def unpublish(self):
        self.published = False
        self.save()

    @property
    def owner_type(self):
        if self.organization_set.count() > 0:
            return "org"
        elif self.pytitionuser_set.count() > 0:
            return "user"
        else:
            return "no_owner"

    @property
    def owner(self):
        if self.organization_set.count() > 0:
            return self.organization_set.first()
        elif self.pytitionuser_set.count() > 0:
            return self.pytitionuser_set.first()
        else:
            return None

    @property
    def signature_number(self):
        return self.get_signature_number(True)

    @property
    def raw_twitter_description(self):
        return html.unescape(mark_safe(strip_tags(self.twitter_description)))

    @property
    def raw_text(self):
        return html.unescape(mark_safe(strip_tags(self.text)))

    @property
    def raw_title(self):
        return html.unescape(mark_safe(strip_tags(self.title).strip()))

    def __str__(self):
        return self.raw_title

    def __repr__(self):
        return self.raw_title

    @property
    def url(self):
        slugs = self.slugs.all()
        if len(slugs) == 0:
            # If there is no slug, ugly url
            return reverse('detail', kwargs={'petition_id': self.id})
        else:
            if self.organization_set.count() > 0:
                #  This petition is owned by an Organization
                org = self.organization_set.first()
                return reverse("slug_show_petition",
                           kwargs={"orgslugname": org.slugname,
                               "petitionname": slugs[0]})
            elif self.pytitionuser_set.count() > 0:
                # This petition is owned by a PytitionUser
                user = self.pytitionuser_set.first()
                return reverse("slug_show_petition",
                           kwargs={"username": user.user.username,
                               "petitionname": slugs[0]})
            else:
                # This is a BUG!
                raise ValueError(_("This petition is buggy. Sorry about that!"))


class SlugOwnership(models.Model):
    petition = models.ForeignKey(Petition, on_delete=models.CASCADE)
    slug = models.ForeignKey('SlugModel', on_delete=models.CASCADE)
    user = models.ForeignKey('PytitionUser', on_delete=models.CASCADE, blank=True, null=True, default=None)
    organization = models.ForeignKey('Organization', on_delete=models.CASCADE, blank=True, null=True, default=None)

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['slug', 'organization'], name="unique_slugnameperorg", condition=Q(user=None)),
            models.UniqueConstraint(fields=['slug', 'user'], name="unique_slugnameperuser",
                                    condition=Q(organization=None)),
        ]


class Signature(models.Model):
    first_name = models.CharField(max_length=50, verbose_name=ugettext_lazy("First name"))
    last_name = models.CharField(max_length=50, verbose_name=ugettext_lazy("Last name"))
    phone = models.CharField(max_length=20, blank=True, verbose_name=ugettext_lazy("Phone number"))
    email = models.EmailField(verbose_name=ugettext_lazy("Email address"))
    confirmation_hash = models.CharField(max_length=128)
    confirmed = models.BooleanField(default=False, verbose_name=ugettext_lazy("Confirmed"))
    petition = models.ForeignKey(Petition, on_delete=models.CASCADE, verbose_name=ugettext_lazy("Petition"))
    subscribed_to_mailinglist = models.BooleanField(default=False, verbose_name=ugettext_lazy("Subscribed to mailing list"))
    date = models.DateTimeField(blank=True, auto_now_add=True, verbose_name=ugettext_lazy("Date"))
    ipaddress = models.TextField(blank=True, null=True)

    def clean(self):
        if self.petition.already_signed(self.email):
            if self.petition.signature_set.filter(email = self.email).get(confirmed = True).id != self.id:
                raise ValidationError(_("You already signed the petition"))

    def save(self, *args, **kwargs):
        self.clean()
        if self.confirmed:
            # invalidating other signatures from same email
            Signature.objects.filter(petition=self.petition).filter(email=self.email)\
                .exclude(id=self.id).delete()
        super().save(*args, **kwargs)

    def confirm(self):
        self.confirmed = True

    def __str__(self):
        return html.unescape("[{}:{}] {} {}".format(self.petition.id, "OK" if self.confirmed else "..", self.first_name,
                                                    self.last_name))

    def __repr__(self):
        return html.unescape("[{}:{}] {} {}".format(self.petition.id, "OK" if self.confirmed else "..", self.first_name,
                                                    self.last_name))


class PetitionTemplate(models.Model):

    NO =           "no gradient"
    RIGHT =        "to right"
    BOTTOM =       "to bottom"
    BOTTOM_RIGHT = "to bottom right"
    BOTTOM_LEFT =  "to bottom left"

    LINEAR_GRADIENT_CHOICES = (
        (NO,           "no gradient"),
        (RIGHT,        "to right"),
        (BOTTOM,       "to bottom"),
        (BOTTOM_RIGHT, "to bottom right"),
        (BOTTOM_LEFT,  "to bottom left")
    )

    MAIL = "MAIL"
    POST = "POST"
    GET = "GET"

    NEWSLETTER_SUBSCRIBE_METHOD_CHOICES = (
        (MAIL, "MAIL"),
        (POST, "POST"),
        (GET,  "GET")
    )

    name = models.CharField(max_length=50, verbose_name=ugettext_lazy("Name"), db_index=True)
    text = tinymce_models.HTMLField(blank=True)
    side_text = tinymce_models.HTMLField(blank=True)
    target = models.IntegerField(blank=True, null=True)
    linear_gradient_direction = models.CharField(choices=LINEAR_GRADIENT_CHOICES, max_length=15, default=NO, blank=True)
    gradient_from = ColorField(blank=True)
    gradient_to = ColorField(blank=True)
    bgcolor = ColorField(blank=True)
    footer_text = tinymce_models.HTMLField(blank=True)
    footer_links = tinymce_models.HTMLField(blank=True)
    twitter_description = models.CharField(max_length=200, blank=True)
    twitter_image = models.CharField(max_length=500, blank=True)
    has_newsletter = models.BooleanField(default=False)
    newsletter_subscribe_http_data = models.TextField(blank=True)
    newsletter_subscribe_http_mailfield = models.CharField(max_length=100, blank=True)
    newsletter_subscribe_http_url = models.CharField(max_length=1000, blank=True)
    newsletter_subscribe_mail_subject = models.CharField(max_length=1000, blank=True)
    newsletter_subscribe_mail_from = models.EmailField(max_length=500, blank=True)
    newsletter_subscribe_mail_to = models.EmailField(max_length=500, blank=True)
    newsletter_subscribe_method = models.CharField(choices=NEWSLETTER_SUBSCRIBE_METHOD_CHOICES, max_length=4,
                                                   default=MAIL)
    newsletter_subscribe_mail_smtp_host = models.CharField(max_length=100, default='localhost', blank=True)
    newsletter_subscribe_mail_smtp_port = models.IntegerField(default=25)
    newsletter_subscribe_mail_smtp_user = models.CharField(max_length=200, blank=True)
    newsletter_subscribe_mail_smtp_password = models.CharField(max_length=200, blank=True)
    newsletter_subscribe_mail_smtp_tls = models.BooleanField(default=False)
    newsletter_subscribe_mail_smtp_starttls = models.BooleanField(default=False)
    org_twitter_handle = models.CharField(max_length=20, blank=True)
    newsletter_text = models.CharField(max_length=1000, blank=True)
    sign_form_footer = models.TextField(blank=True)
    confirmation_email_sender = models.EmailField(max_length=100, blank=True)
    confirmation_email_smtp_host = models.CharField(max_length=100, default='localhost', blank=True)
    confirmation_email_smtp_port = models.IntegerField(default=25, blank=True)
    confirmation_email_smtp_user = models.CharField(max_length=200, blank=True)
    confirmation_email_smtp_password = models.CharField(max_length=200, blank=True)
    confirmation_email_smtp_tls = models.BooleanField(default=False)
    confirmation_email_smtp_starttls = models.BooleanField(default=False)
    use_custom_email_settings = models.BooleanField(default=False)

    def __str__(self):
        return self.name

    def __repr__(self):
        return self.name

    class Meta:
        index_together = ["id", ]


class SlugModel(models.Model):
    slug = models.SlugField(max_length=200)

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['slug'], name='unique_slugname')
        ]

    def __str__(self):
        return self.slug

    def __repr__(self):
        return self.slug


class Organization(models.Model):
    name = models.CharField(max_length=200, verbose_name=ugettext_lazy("Name"), unique=True)
    petition_templates = models.ManyToManyField(PetitionTemplate, through='TemplateOwnership',
                                                through_fields=['organization', 'template'], blank=True,
                                                verbose_name=ugettext_lazy("Petition templates"))
    petitions = models.ManyToManyField(Petition, blank=True, verbose_name=ugettext_lazy("Petitions"))
    default_template = models.ForeignKey(PetitionTemplate, blank=True, null=True, related_name='+',
                                         verbose_name=ugettext_lazy("Default petition template"), to_field='id',
                                         on_delete=models.SET_NULL)
    slugname = models.SlugField(max_length=200, unique=True)

    def drop(self):
        with transaction.atomic():
            petitions = list(self.petitions.all())
            templates = list(self.petition_templates.all())
            self.delete()
            for petition in petitions:
                petition.delete()
            for template in templates:
                template.delete()

    def add_member(self, member):
        member.organizations.add(self)
        permission = Permission.objects.create(organization=self)
        permission.save()
        member.permissions.add(permission)
        member.save()

    def __str__(self):
        return self.name

    def __repr__(self):
        return self.name

    def save(self, *args, **kwargs):
        if not self.slugname:
            self.slugname = slugify(self.name)
        super(Organization, self).save(*args, **kwargs)

    @property
    def kind(self):
        return "org"

    @property
    def fullname(self):
        return self.name

    def save(self, *args, **kwargs):
        self.slugname = slugify(self.name)
        super(Organization, self).save(*args, **kwargs)


class Permission(models.Model):
    organization = models.ForeignKey(Organization, on_delete=models.CASCADE,
                                     verbose_name=ugettext_lazy("Organization related to these permissions"))
    can_add_members = models.BooleanField(default=False)
    can_remove_members = models.BooleanField(default=False)
    can_create_petitions = models.BooleanField(default=False)
    can_modify_petitions = models.BooleanField(default=False)
    can_delete_petitions = models.BooleanField(default=False)
    can_create_templates = models.BooleanField(default=False)
    can_modify_templates = models.BooleanField(default=False)
    can_delete_templates = models.BooleanField(default=False)
    can_view_signatures = models.BooleanField(default=False)
    can_modify_signatures = models.BooleanField(default=False)
    can_delete_signatures = models.BooleanField(default=False)
    can_modify_permissions = models.BooleanField(default=False)

    def set_all(self, value):
        self.can_add_members = value
        self.can_remove_members = value
        self.can_create_petitions = value
        self.can_modify_petitions = value
        self.can_delete_petitions = value
        self.can_create_templates = value
        self.can_modify_templates = value
        self.can_delete_templates = value
        self.can_view_signatures = value
        self.can_modify_signatures = value
        self.can_delete_signatures = value
        self.can_modify_permissions = value
        self.save()


    def __str__(self):
        ret = "{orgname} : ".format(orgname=self.organization.name)
        if self.user.count() > 0:
            ret = ret + "{username}".format(username=self.user.all()[0].name)
        else:
            ret = ret + "None"
        return ret

    def __repr__(self):
        return self.__str__()


class PytitionUser(models.Model):
    petitions = models.ManyToManyField(Petition, blank=True)
    organizations = models.ManyToManyField(Organization, related_name="members", blank=True)
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="pytitionuser")
    permissions = models.ManyToManyField(Permission, related_name="user", blank=True)
    invitations = models.ManyToManyField(Organization, related_name="invited", blank=True)
    petition_templates = models.ManyToManyField(PetitionTemplate, blank=True, through='TemplateOwnership',
                                                through_fields=['user', 'template'],
                                                verbose_name=ugettext_lazy("Petition templates"))
    default_template = models.ForeignKey(PetitionTemplate, blank=True, null=True, related_name='+',
                                         verbose_name=ugettext_lazy("Default petition template"), to_field='id',
                                         on_delete=models.SET_NULL)


    def has_right(self, right, petition=None, org=None):
        if petition:
            if petition in self.petitions.all():
                return True
            try:
                if not org:
                    org = Organization.objects.get(petitions=petition, members=self)
                permissions = self.permissions.get(organization=org)
                return getattr(permissions, right)
            except:
                return False
        if org:
            try:
                permissions = self.permissions.get(organization=org)
                return getattr(permissions, right)
            except:
                return False
        return False


    def drop(self):
        with transaction.atomic():
            orgs = list(self.organizations.all())
            petitions = list(self.petitions.all())
            templates = list(self.petition_templates.all())
            self.delete()
            for org in orgs:
                if org.members.count() == 0:
                    org.drop()
            for petition in petitions:
                petition.delete()
            for template in templates:
                template.delete()

    @property
    def is_authenticated(self):
        return self.user.is_authenticated

    @property
    def name(self):
        return self.username

    @property
    def username(self):
        return self.user.username

    @property
    def get_full_name(self):
        return self.user.get_full_name()

    @property
    def fullname(self):
        return self.get_full_name

    @property
    def kind(self):
        return "user"

    def __str__(self):
        return self.get_full_name

    def __repr__(self):
        return self.get_full_name


@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_user_profile(sender, instance, created, **kwargs):
    if created:
        PytitionUser.objects.create(user=instance)


@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def save_user_profile(sender, instance, **kwargs):
    instance.pytitionuser.save()


@receiver(post_save, sender=Organization)
def save_user_profile(sender, instance, **kwargs):
    if not instance.slugname:
        slugtext = slugify(instance.name)
        instance.slugname = slugtext
        instance.save()


@receiver(post_delete, sender=PytitionUser)
def post_delete_user(sender, instance, *args, **kwargs):
    if instance.user:  # just in case user is not specified
        instance.user.delete()

class TemplateOwnership(models.Model):
    user = models.ForeignKey(PytitionUser, blank=True, null=True, on_delete=models.CASCADE)
    organization = models.ForeignKey(Organization, blank=True, null=True, on_delete=models.CASCADE)
    template = models.ForeignKey(PetitionTemplate, to_field='id', on_delete=models.CASCADE)

    def clean(self):
        if self.user is None and self.organization is None:
            raise ValidationError(_("The template needs to be owned by a User or an Organization."
                                    "It cannot hang around alone by itself."))
    #class Meta:
    #    unique_together = (("user", "template"), ("organization", "template"))

[((22649, 22701), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'settings.AUTH_USER_MODEL'}), '(post_save, sender=settings.AUTH_USER_MODEL)\n', (22657, 22701), False, 'from django.dispatch import receiver\n'), ((22834, 22886), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'settings.AUTH_USER_MODEL'}), '(post_save, sender=settings.AUTH_USER_MODEL)\n', (22842, 22886), False, 'from django.dispatch import receiver\n'), ((22974, 23014), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Organization'}), '(post_save, sender=Organization)\n', (22982, 23014), False, 'from django.dispatch import receiver\n'), ((23202, 23244), 'django.dispatch.receiver', 'receiver', (['post_delete'], {'sender': 'PytitionUser'}), '(post_delete, sender=PytitionUser)\n', (23210, 23244), False, 'from django.dispatch import receiver\n'), ((1338, 1374), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (1362, 1374), True, 'from tinymce import models as tinymce_models\n'), ((1391, 1427), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (1415, 1427), True, 'from tinymce import models as tinymce_models\n'), ((1441, 1473), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(500)'}), '(default=500)\n', (1460, 1473), False, 'from django.db import models\n'), ((1506, 1598), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'LINEAR_GRADIENT_CHOICES', 'max_length': '(15)', 'default': 'NO', 'blank': '(True)'}), '(choices=LINEAR_GRADIENT_CHOICES, max_length=15, default=NO,\n    blank=True)\n', (1522, 1598), False, 'from django.db import models\n'), ((1615, 1637), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (1625, 1637), False, 'from colorfield.fields import ColorField\n'), ((1656, 1678), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (1666, 1678), False, 'from colorfield.fields import ColorField\n'), ((1693, 1715), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (1703, 1715), False, 'from colorfield.fields import ColorField\n'), ((1734, 1770), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (1758, 1770), True, 'from tinymce import models as tinymce_models\n'), ((1790, 1826), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (1814, 1826), True, 'from tinymce import models as tinymce_models\n'), ((1853, 1897), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (1869, 1897), False, 'from django.db import models\n'), ((1918, 1962), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (1934, 1962), False, 'from django.db import models\n'), ((1984, 2018), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (2003, 2018), False, 'from django.db import models\n'), ((2056, 2084), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (2072, 2084), False, 'from django.db import models\n'), ((2127, 2171), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)'}), '(max_length=100, blank=True)\n', (2143, 2171), False, 'from django.db import models\n'), ((2208, 2253), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (2224, 2253), False, 'from django.db import models\n'), ((2294, 2339), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (2310, 2339), False, 'from django.db import models\n'), ((2377, 2421), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (2393, 2421), False, 'from django.db import models\n'), ((2457, 2501), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (2473, 2501), False, 'from django.db import models\n'), ((2536, 2629), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'NEWSLETTER_SUBSCRIBE_METHOD_CHOICES', 'max_length': '(4)', 'default': 'MAIL'}), '(choices=NEWSLETTER_SUBSCRIBE_METHOD_CHOICES, max_length=4,\n    default=MAIL)\n', (2552, 2629), False, 'from django.db import models\n'), ((2719, 2784), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""localhost"""', 'blank': '(True)'}), "(max_length=100, default='localhost', blank=True)\n", (2735, 2784), False, 'from django.db import models\n'), ((2827, 2870), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(25)', 'blank': '(True)'}), '(default=25, blank=True)\n', (2846, 2870), False, 'from django.db import models\n'), ((2913, 2957), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (2929, 2957), False, 'from django.db import models\n'), ((3004, 3048), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (3020, 3048), False, 'from django.db import models\n'), ((3090, 3124), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (3109, 3124), False, 'from django.db import models\n'), ((3171, 3205), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (3190, 3205), False, 'from django.db import models\n'), ((3231, 3274), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'blank': '(True)'}), '(max_length=20, blank=True)\n', (3247, 3274), False, 'from django.db import models\n'), ((3291, 3325), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (3310, 3325), False, 'from django.db import models\n'), ((3348, 3393), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (3364, 3393), False, 'from django.db import models\n'), ((3417, 3445), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (3433, 3445), False, 'from django.db import models\n'), ((3478, 3522), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)'}), '(max_length=100, blank=True)\n', (3494, 3522), False, 'from django.db import models\n'), ((3558, 3623), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""localhost"""', 'blank': '(True)'}), "(max_length=100, default='localhost', blank=True)\n", (3574, 3623), False, 'from django.db import models\n'), ((3659, 3702), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(25)', 'blank': '(True)'}), '(default=25, blank=True)\n', (3678, 3702), False, 'from django.db import models\n'), ((3738, 3782), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (3754, 3782), False, 'from django.db import models\n'), ((3822, 3866), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (3838, 3866), False, 'from django.db import models\n'), ((3901, 3935), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (3920, 3935), False, 'from django.db import models\n'), ((3975, 4009), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (3994, 4009), False, 'from django.db import models\n'), ((4042, 4076), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (4061, 4076), False, 'from django.db import models\n'), ((4088, 4116), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (4104, 4116), False, 'from django.db import models\n'), ((4129, 4201), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""SlugModel"""'], {'blank': '(True)', 'through': '"""SlugOwnership"""'}), "('SlugModel', blank=True, through='SlugOwnership')\n", (4151, 4201), False, 'from django.db import models\n'), ((9527, 9580), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Petition'], {'on_delete': 'models.CASCADE'}), '(Petition, on_delete=models.CASCADE)\n', (9544, 9580), False, 'from django.db import models\n'), ((9592, 9648), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""SlugModel"""'], {'on_delete': 'models.CASCADE'}), "('SlugModel', on_delete=models.CASCADE)\n", (9609, 9648), False, 'from django.db import models\n'), ((9660, 9760), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""PytitionUser"""'], {'on_delete': 'models.CASCADE', 'blank': '(True)', 'null': '(True)', 'default': 'None'}), "('PytitionUser', on_delete=models.CASCADE, blank=True,\n    null=True, default=None)\n", (9677, 9760), False, 'from django.db import models\n'), ((9776, 9876), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Organization"""'], {'on_delete': 'models.CASCADE', 'blank': '(True)', 'null': '(True)', 'default': 'None'}), "('Organization', on_delete=models.CASCADE, blank=True,\n    null=True, default=None)\n", (9793, 9876), False, 'from django.db import models\n'), ((10621, 10653), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (10637, 10653), False, 'from django.db import models\n'), ((11095, 11134), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (11111, 11134), False, 'from django.db import models\n'), ((12916, 12952), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (12940, 12952), True, 'from tinymce import models as tinymce_models\n'), ((12969, 13005), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (12993, 13005), True, 'from tinymce import models as tinymce_models\n'), ((13019, 13061), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (13038, 13061), False, 'from django.db import models\n'), ((13094, 13186), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'LINEAR_GRADIENT_CHOICES', 'max_length': '(15)', 'default': 'NO', 'blank': '(True)'}), '(choices=LINEAR_GRADIENT_CHOICES, max_length=15, default=NO,\n    blank=True)\n', (13110, 13186), False, 'from django.db import models\n'), ((13203, 13225), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (13213, 13225), False, 'from colorfield.fields import ColorField\n'), ((13244, 13266), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (13254, 13266), False, 'from colorfield.fields import ColorField\n'), ((13281, 13303), 'colorfield.fields.ColorField', 'ColorField', ([], {'blank': '(True)'}), '(blank=True)\n', (13291, 13303), False, 'from colorfield.fields import ColorField\n'), ((13322, 13358), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (13346, 13358), True, 'from tinymce import models as tinymce_models\n'), ((13378, 13414), 'tinymce.models.HTMLField', 'tinymce_models.HTMLField', ([], {'blank': '(True)'}), '(blank=True)\n', (13402, 13414), True, 'from tinymce import models as tinymce_models\n'), ((13441, 13485), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (13457, 13485), False, 'from django.db import models\n'), ((13506, 13550), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (13522, 13550), False, 'from django.db import models\n'), ((13572, 13606), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (13591, 13606), False, 'from django.db import models\n'), ((13644, 13672), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (13660, 13672), False, 'from django.db import models\n'), ((13715, 13759), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)'}), '(max_length=100, blank=True)\n', (13731, 13759), False, 'from django.db import models\n'), ((13796, 13841), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (13812, 13841), False, 'from django.db import models\n'), ((13882, 13927), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (13898, 13927), False, 'from django.db import models\n'), ((13965, 14010), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (13982, 14010), False, 'from django.db import models\n'), ((14046, 14091), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(500)', 'blank': '(True)'}), '(max_length=500, blank=True)\n', (14063, 14091), False, 'from django.db import models\n'), ((14126, 14219), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'NEWSLETTER_SUBSCRIBE_METHOD_CHOICES', 'max_length': '(4)', 'default': 'MAIL'}), '(choices=NEWSLETTER_SUBSCRIBE_METHOD_CHOICES, max_length=4,\n    default=MAIL)\n', (14142, 14219), False, 'from django.db import models\n'), ((14309, 14374), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""localhost"""', 'blank': '(True)'}), "(max_length=100, default='localhost', blank=True)\n", (14325, 14374), False, 'from django.db import models\n'), ((14417, 14448), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(25)'}), '(default=25)\n', (14436, 14448), False, 'from django.db import models\n'), ((14491, 14535), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (14507, 14535), False, 'from django.db import models\n'), ((14582, 14626), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (14598, 14626), False, 'from django.db import models\n'), ((14668, 14702), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (14687, 14702), False, 'from django.db import models\n'), ((14749, 14783), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (14768, 14783), False, 'from django.db import models\n'), ((14809, 14852), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'blank': '(True)'}), '(max_length=20, blank=True)\n', (14825, 14852), False, 'from django.db import models\n'), ((14875, 14920), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'blank': '(True)'}), '(max_length=1000, blank=True)\n', (14891, 14920), False, 'from django.db import models\n'), ((14944, 14972), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (14960, 14972), False, 'from django.db import models\n'), ((15005, 15050), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(100)', 'blank': '(True)'}), '(max_length=100, blank=True)\n', (15022, 15050), False, 'from django.db import models\n'), ((15086, 15151), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""localhost"""', 'blank': '(True)'}), "(max_length=100, default='localhost', blank=True)\n", (15102, 15151), False, 'from django.db import models\n'), ((15187, 15230), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(25)', 'blank': '(True)'}), '(default=25, blank=True)\n', (15206, 15230), False, 'from django.db import models\n'), ((15266, 15310), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (15282, 15310), False, 'from django.db import models\n'), ((15350, 15394), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (15366, 15394), False, 'from django.db import models\n'), ((15429, 15463), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (15448, 15463), False, 'from django.db import models\n'), ((15503, 15537), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (15522, 15537), False, 'from django.db import models\n'), ((15570, 15604), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (15589, 15604), False, 'from django.db import models\n'), ((15799, 15831), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (15815, 15831), False, 'from django.db import models\n'), ((16884, 16929), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(200)', 'unique': '(True)'}), '(max_length=200, unique=True)\n', (16900, 16929), False, 'from django.db import models\n'), ((18270, 18304), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18289, 18304), False, 'from django.db import models\n'), ((18330, 18364), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18349, 18364), False, 'from django.db import models\n'), ((18392, 18426), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18411, 18426), False, 'from django.db import models\n'), ((18454, 18488), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18473, 18488), False, 'from django.db import models\n'), ((18516, 18550), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18535, 18550), False, 'from django.db import models\n'), ((18578, 18612), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18597, 18612), False, 'from django.db import models\n'), ((18640, 18674), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18659, 18674), False, 'from django.db import models\n'), ((18702, 18736), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18721, 18736), False, 'from django.db import models\n'), ((18763, 18797), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18782, 18797), False, 'from django.db import models\n'), ((18826, 18860), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18845, 18860), False, 'from django.db import models\n'), ((18889, 18923), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18908, 18923), False, 'from django.db import models\n'), ((18953, 18987), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (18972, 18987), False, 'from django.db import models\n'), ((19915, 19959), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['Petition'], {'blank': '(True)'}), '(Petition, blank=True)\n', (19937, 19959), False, 'from django.db import models\n'), ((19980, 20052), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['Organization'], {'related_name': '"""members"""', 'blank': '(True)'}), "(Organization, related_name='members', blank=True)\n", (20002, 20052), False, 'from django.db import models\n'), ((20064, 20169), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE', 'related_name': '"""pytitionuser"""'}), "(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,\n    related_name='pytitionuser')\n", (20084, 20169), False, 'from django.db import models\n'), ((20184, 20251), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['Permission'], {'related_name': '"""user"""', 'blank': '(True)'}), "(Permission, related_name='user', blank=True)\n", (20206, 20251), False, 'from django.db import models\n'), ((20270, 20342), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['Organization'], {'related_name': '"""invited"""', 'blank': '(True)'}), "(Organization, related_name='invited', blank=True)\n", (20292, 20342), False, 'from django.db import models\n'), ((23444, 23529), 'django.db.models.ForeignKey', 'models.ForeignKey', (['PytitionUser'], {'blank': '(True)', 'null': '(True)', 'on_delete': 'models.CASCADE'}), '(PytitionUser, blank=True, null=True, on_delete=models.CASCADE\n    )\n', (23461, 23529), False, 'from django.db import models\n'), ((23544, 23629), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Organization'], {'blank': '(True)', 'null': '(True)', 'on_delete': 'models.CASCADE'}), '(Organization, blank=True, null=True, on_delete=models.CASCADE\n    )\n', (23561, 23629), False, 'from django.db import models\n'), ((23640, 23716), 'django.db.models.ForeignKey', 'models.ForeignKey', (['PetitionTemplate'], {'to_field': '"""id"""', 'on_delete': 'models.CASCADE'}), "(PetitionTemplate, to_field='id', on_delete=models.CASCADE)\n", (23657, 23716), False, 'from django.db import models\n'), ((17952, 17970), 'django.utils.text.slugify', 'slugify', (['self.name'], {}), '(self.name)\n', (17959, 17970), False, 'from django.utils.text import slugify\n'), ((23115, 23137), 'django.utils.text.slugify', 'slugify', (['instance.name'], {}), '(instance.name)\n', (23122, 23137), False, 'from django.utils.text import slugify\n'), ((1303, 1325), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Title"""'], {}), "('Title')\n", (1316, 1325), False, 'from django.utils.translation import ugettext_lazy\n'), ((4691, 4703), 'django.contrib.auth.hashers.get_hasher', 'get_hasher', ([], {}), '()\n', (4701, 4703), False, 'from django.contrib.auth.hashers import get_hasher\n'), ((4868, 4891), 'django.utils.text.slugify', 'slugify', (['self.raw_title'], {}), '(self.raw_title)\n', (4875, 4891), False, 'from django.utils.text import slugify\n'), ((6566, 6611), 'django.utils.translation.ugettext', '_', (['"""Thank you for confirming your signature!"""'], {}), "('Thank you for confirming your signature!')\n", (6567, 6611), True, 'from django.utils.translation import ugettext as _\n'), ((6698, 6718), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (6716, 6718), False, 'from django.db import transaction\n'), ((6743, 6760), 'django.utils.text.slugify', 'slugify', (['slugtext'], {}), '(slugtext)\n', (6750, 6760), False, 'from django.utils.text import slugify\n'), ((8598, 8648), 'django.urls.reverse', 'reverse', (['"""detail"""'], {'kwargs': "{'petition_id': self.id}"}), "('detail', kwargs={'petition_id': self.id})\n", (8605, 8648), False, 'from django.urls import reverse\n'), ((10304, 10331), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""First name"""'], {}), "('First name')\n", (10317, 10331), False, 'from django.utils.translation import ugettext_lazy\n'), ((10394, 10420), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Last name"""'], {}), "('Last name')\n", (10407, 10420), False, 'from django.utils.translation import ugettext_lazy\n'), ((10491, 10520), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Phone number"""'], {}), "('Phone number')\n", (10504, 10520), False, 'from django.utils.translation import ugettext_lazy\n'), ((10565, 10595), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Email address"""'], {}), "('Email address')\n", (10578, 10595), False, 'from django.utils.translation import ugettext_lazy\n'), ((10718, 10744), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Confirmed"""'], {}), "('Confirmed')\n", (10731, 10744), False, 'from django.utils.translation import ugettext_lazy\n'), ((10828, 10853), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Petition"""'], {}), "('Petition')\n", (10841, 10853), False, 'from django.utils.translation import ugettext_lazy\n'), ((10935, 10978), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Subscribed to mailing list"""'], {}), "('Subscribed to mailing list')\n", (10948, 10978), False, 'from django.utils.translation import ugettext_lazy\n'), ((11056, 11077), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Date"""'], {}), "('Date')\n", (11069, 11077), False, 'from django.utils.translation import ugettext_lazy\n'), ((12867, 12888), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Name"""'], {}), "('Name')\n", (12880, 12888), False, 'from django.utils.translation import ugettext_lazy\n'), ((15885, 15949), 'django.db.models.UniqueConstraint', 'models.UniqueConstraint', ([], {'fields': "['slug']", 'name': '"""unique_slugname"""'}), "(fields=['slug'], name='unique_slugname')\n", (15908, 15949), False, 'from django.db import models\n'), ((16152, 16173), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Name"""'], {}), "('Name')\n", (16165, 16173), False, 'from django.utils.translation import ugettext_lazy\n'), ((16449, 16484), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Petition templates"""'], {}), "('Petition templates')\n", (16462, 16484), False, 'from django.utils.translation import ugettext_lazy\n'), ((16560, 16586), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Petitions"""'], {}), "('Petitions')\n", (16573, 16586), False, 'from django.utils.translation import ugettext_lazy\n'), ((16742, 16784), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Default petition template"""'], {}), "('Default petition template')\n", (16755, 16784), False, 'from django.utils.translation import ugettext_lazy\n'), ((16964, 16984), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (16982, 16984), False, 'from django.db import transaction\n'), ((17695, 17713), 'django.utils.text.slugify', 'slugify', (['self.name'], {}), '(self.name)\n', (17702, 17713), False, 'from django.utils.text import slugify\n'), ((18188, 18246), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Organization related to these permissions"""'], {}), "('Organization related to these permissions')\n", (18201, 18246), False, 'from django.utils.translation import ugettext_lazy\n'), ((20596, 20631), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Petition templates"""'], {}), "('Petition templates')\n", (20609, 20631), False, 'from django.utils.translation import ugettext_lazy\n'), ((20787, 20829), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Default petition template"""'], {}), "('Default petition template')\n", (20800, 20829), False, 'from django.utils.translation import ugettext_lazy\n'), ((21628, 21648), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (21646, 21648), False, 'from django.db import transaction\n'), ((8078, 8114), 'django.utils.html.strip_tags', 'strip_tags', (['self.twitter_description'], {}), '(self.twitter_description)\n', (8088, 8114), False, 'from django.utils.html import mark_safe, strip_tags\n'), ((8195, 8216), 'django.utils.html.strip_tags', 'strip_tags', (['self.text'], {}), '(self.text)\n', (8205, 8216), False, 'from django.utils.html import mark_safe, strip_tags\n'), ((8849, 8946), 'django.urls.reverse', 'reverse', (['"""slug_show_petition"""'], {'kwargs': "{'orgslugname': org.slugname, 'petitionname': slugs[0]}"}), "('slug_show_petition', kwargs={'orgslugname': org.slugname,\n    'petitionname': slugs[0]})\n", (8856, 8946), False, 'from django.urls import reverse\n'), ((23833, 23941), 'django.utils.translation.ugettext', '_', (['"""The template needs to be owned by a User or an Organization.It cannot hang around alone by itself."""'], {}), "('The template needs to be owned by a User or an Organization.It cannot hang around alone by itself.'\n    )\n", (23834, 23941), True, 'from django.utils.translation import ugettext as _\n'), ((5436, 5514), 'django.utils.translation.ugettext', '_', (['"""This slug is already used by another petition from this organization/user"""'], {}), "('This slug is already used by another petition from this organization/user')\n", (5437, 5514), True, 'from django.utils.translation import ugettext as _\n'), ((5551, 5568), 'django.utils.text.slugify', 'slugify', (['slugtext'], {}), '(slugtext)\n', (5558, 5568), False, 'from django.utils.text import slugify\n'), ((9188, 9288), 'django.urls.reverse', 'reverse', (['"""slug_show_petition"""'], {'kwargs': "{'username': user.user.username, 'petitionname': slugs[0]}"}), "('slug_show_petition', kwargs={'username': user.user.username,\n    'petitionname': slugs[0]})\n", (9195, 9288), False, 'from django.urls import reverse\n'), ((10023, 10035), 'django.db.models.Q', 'Q', ([], {'user': 'None'}), '(user=None)\n', (10024, 10035), False, 'from django.db.models import Q\n'), ((10176, 10196), 'django.db.models.Q', 'Q', ([], {'organization': 'None'}), '(organization=None)\n', (10177, 10196), False, 'from django.db.models import Q\n'), ((11355, 11391), 'django.utils.translation.ugettext', '_', (['"""You already signed the petition"""'], {}), "('You already signed the petition')\n", (11356, 11391), True, 'from django.utils.translation import ugettext as _\n'), ((7140, 7189), 'django.utils.translation.ugettext', '_', (['"""This petition has no owner, cannot add slug!"""'], {}), "('This petition has no owner, cannot add slug!')\n", (7141, 7189), True, 'from django.utils.translation import ugettext as _\n'), ((8298, 8320), 'django.utils.html.strip_tags', 'strip_tags', (['self.title'], {}), '(self.title)\n', (8308, 8320), False, 'from django.utils.html import mark_safe, strip_tags\n'), ((9427, 9473), 'django.utils.translation.ugettext', '_', (['"""This petition is buggy. Sorry about that!"""'], {}), "('This petition is buggy. Sorry about that!')\n", (9428, 9473), True, 'from django.utils.translation import ugettext as _\n')]