Exemple #1
0
class TicketMessage(models.Model):
    TYPE_CUSTOMER = "C"
    TYPE_RESPONSE = "R"
    TYPE_NOTE = "N"
    TYPE_SYSTEM = "S"
    TYPES = ((TYPE_CUSTOMER, "Customer"), (TYPE_RESPONSE, "Response"),
             (TYPE_NOTE, "Note"), (TYPE_SYSTEM, "System"))

    id = as207960_utils.models.TypedUUIDField("support_ticketmessage",
                                              primary_key=True)
    ticket = models.ForeignKey(Ticket,
                               on_delete=models.CASCADE,
                               related_name='messages')
    type = models.CharField(max_length=1, choices=TYPES)
    date = models.DateTimeField()
    message = models.TextField()
    email_message_id = models.TextField(blank=True, null=True)

    @property
    def message_safe(self):
        doc = lxml.html.document_fromstring(self.message)
        cleaner = lxml.html.clean.Cleaner(style=True, inline_style=False)
        clean_doc = cleaner.clean_html(doc)
        return lxml.html.tostring(clean_doc).decode()

    class Meta:
        ordering = ['date']
class Migration(migrations.Migration):

    dependencies = [
        ('domains', '0044_domainregistration_transfer_out_pending'),
    ]

    operations = [
        migrations.CreateModel(
            name='DomainAutomaticRenewOrder',
            fields=[
                ('state',
                 models.CharField(choices=[('T', 'Started'),
                                           ('N', 'Needs payment'),
                                           ('S', 'Processing'),
                                           ('A', 'Pending approval'),
                                           ('C', 'Completed'),
                                           ('F', 'Failed')],
                                  default='T',
                                  max_length=1)),
                ('charge_state_id',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('price', models.DecimalField(decimal_places=2, max_digits=9)),
                ('redirect_uri', models.TextField(blank=True, null=True)),
                ('last_error', models.TextField(blank=True, null=True)),
                ('off_session', models.BooleanField(blank=True, default=True)),
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='domains_domainautoreneworder',
                     primary_key=True,
                     serialize=False)),
                ('domain', models.CharField(max_length=255)),
                ('period_unit', models.PositiveSmallIntegerField()),
                ('period_value', models.PositiveSmallIntegerField()),
                ('domain_obj',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='domains.DomainRegistration')),
            ],
            options={
                'ordering': ['domain'],
            },
        ),
    ]
Exemple #3
0
class Migration(migrations.Migration):

    dependencies = [
        ('dns_grpc', '0008_auto_20210309_1222'),
    ]

    operations = [
        migrations.AddField(
            model_name='reversednszone',
            name='cds_disable',
            field=models.BooleanField(blank=True, default=False),
        ),
        migrations.AddField(
            model_name='secondarydnszone',
            name='cds_disable',
            field=models.BooleanField(blank=True, default=False),
        ),
        migrations.AlterField(
            model_name='dnszoneadditionalcdnskey',
            name='dns_zone',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='additional_cdnskey',
                to='dns_grpc.DNSZone'),
        ),
        migrations.AlterField(
            model_name='dnszoneadditionalcds',
            name='dns_zone',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='additional_cds',
                to='dns_grpc.DNSZone'),
        ),
        migrations.CreateModel(
            name='ReverseDNSZoneAdditionalCDS',
            fields=[
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='hexdns_rzoneadditionalcds',
                     primary_key=True,
                     serialize=False)),
                ('key_tag',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(0),
                     django.core.validators.MaxValueValidator(65535)
                 ])),
                ('algorithm',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(1),
                     django.core.validators.MaxValueValidator(255)
                 ])),
                ('digest_type',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(1),
                     django.core.validators.MaxValueValidator(255)
                 ])),
                ('digest',
                 models.TextField(validators=[dns_grpc.models.hex_validator])),
                ('dns_zone',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='additional_cds',
                                   to='dns_grpc.ReverseDNSZone')),
            ],
        ),
        migrations.CreateModel(
            name='ReverseDNSZoneAdditionalCDNSKEY',
            fields=[
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='hexdns_rzoneadditionalcdnskey',
                     primary_key=True,
                     serialize=False)),
                ('flags',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(0),
                     django.core.validators.MaxValueValidator(65535)
                 ])),
                ('protocol',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(1),
                     django.core.validators.MaxValueValidator(255)
                 ])),
                ('algorithm',
                 models.SmallIntegerField(validators=[
                     django.core.validators.MinValueValidator(1),
                     django.core.validators.MaxValueValidator(255)
                 ])),
                ('public_key',
                 models.TextField(validators=[dns_grpc.models.b64_validator])),
                ('dns_zone',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='additional_cdnskey',
                                   to='dns_grpc.ReverseDNSZone')),
            ],
        ),
    ]
Exemple #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('dns_grpc', '0012_auto_20210415_1123'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='addressrecord',
            options={'ordering': ['record_name']},
        ),
        migrations.AlterModelOptions(
            name='anamerecord',
            options={'ordering': ['record_name'], 'verbose_name': 'ANAME record', 'verbose_name_plural': 'ANAME records'},
        ),
        migrations.AlterModelOptions(
            name='caarecord',
            options={'ordering': ['record_name'], 'verbose_name': 'CAA record', 'verbose_name_plural': 'CAA records'},
        ),
        migrations.AlterModelOptions(
            name='cnamerecord',
            options={'ordering': ['record_name'], 'verbose_name': 'CNAME record', 'verbose_name_plural': 'CNAME records'},
        ),
        migrations.AlterModelOptions(
            name='dsrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'DS record', 'verbose_name_plural': 'DS records'},
        ),
        migrations.AlterModelOptions(
            name='dynamicaddressrecord',
            options={'ordering': ['record_name']},
        ),
        migrations.AlterModelOptions(
            name='hinforecord',
            options={'ordering': ['record_name'], 'verbose_name': 'HINFO record', 'verbose_name_plural': 'HINFO records'},
        ),
        migrations.AlterModelOptions(
            name='locrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'LOC record', 'verbose_name_plural': 'LOC records'},
        ),
        migrations.AlterModelOptions(
            name='mxrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'MX record', 'verbose_name_plural': 'MX records'},
        ),
        migrations.AlterModelOptions(
            name='naptrrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'NAPTR record', 'verbose_name_plural': 'NAPTR records'},
        ),
        migrations.AlterModelOptions(
            name='nsrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'NS record', 'verbose_name_plural': 'NS records'},
        ),
        migrations.AlterModelOptions(
            name='rprecord',
            options={'ordering': ['record_name'], 'verbose_name': 'RP record', 'verbose_name_plural': 'RP records'},
        ),
        migrations.AlterModelOptions(
            name='srvrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'SRV record', 'verbose_name_plural': 'SRV records'},
        ),
        migrations.AlterModelOptions(
            name='sshfprecord',
            options={'ordering': ['record_name'], 'verbose_name': 'SSHFP record', 'verbose_name_plural': 'SSHFP records'},
        ),
        migrations.AlterModelOptions(
            name='txtrecord',
            options={'ordering': ['record_name'], 'verbose_name': 'TXT record', 'verbose_name_plural': 'TXT records'},
        ),
        migrations.CreateModel(
            name='HTTPSRecord',
            fields=[
                ('record_name', models.CharField(default='@', max_length=255, verbose_name='Record name (@ for zone root)')),
                ('ttl', models.PositiveIntegerField(default=3600, verbose_name='Time to Live (seconds)')),
                ('priority', models.PositiveSmallIntegerField(default=1, help_text='Record ordering, from lowest to highest, use 0 for alias mode', validators=[django.core.validators.MaxValueValidator(65535)])),
                ('target', models.CharField(default='.', help_text='A DNS name for rewritten connections', max_length=255)),
                ('target_port', models.PositiveSmallIntegerField(blank=True, validators=[django.core.validators.MaxValueValidator(65535)])),
                ('alpns', models.TextField(blank=True, help_text='A comma separated list of supported TLS ALPNs', null=True, verbose_name='ALPNs')),
                ('alpn_mandatory', models.BooleanField(blank=True, help_text='Indicate that ALPN support is required for the connection to succeed', verbose_name='ALPN mandatory')),
                ('no_default_alpn', models.BooleanField(blank=True, help_text='The server does not support the default ALPNs', verbose_name='No default ALPNs')),
                ('ech', models.TextField(blank=True, help_text='TLS Encrypted Client Hello config, Base64 encoded', null=True, verbose_name='TLS ECH')),
                ('ech_mandatory', models.BooleanField(blank=True, help_text='Indicate that TLS ECH support is required for the connection to succeed', verbose_name='ECH mandatory')),
                ('ipv4_hints', models.TextField(blank=True, help_text='A comma separated list of IPv4 addresses to reduce DNS round trips', verbose_name='IPv4 hints')),
                ('ipv4_hints_mandatory', models.BooleanField(blank=True, help_text='Indicate that IPv4 hint support is required for the connection to succeed', verbose_name='IPv4 hints mandatory')),
                ('ipv6_hints', models.TextField(blank=True, help_text='A comma separated list of IPv4 addresses to reduce DNS round trips', verbose_name='IPv6 hints')),
                ('ipv6_hints_mandatory', models.BooleanField(blank=True, help_text='Indicate that IPv6 hint support is required for the connection to succeed', verbose_name='IPv6 hints mandatory')),
                ('extra_params', models.TextField(blank=True, help_text='Extra SVCB parameters not otherwise broken out into individual fields', verbose_name='Extra parameters')),
                ('port', models.PositiveSmallIntegerField(blank=True, default=443, null=True, validators=[django.core.validators.MaxValueValidator(65535)])),
                ('scheme', models.CharField(blank=True, default='https', max_length=255, null=True)),
                ('id', as207960_utils.models.TypedUUIDField(data_type='hexdns_zonehttpsrecord', primary_key=True, serialize=False)),
                ('http2_support', models.BooleanField(blank=True, verbose_name='HTTP/2 support')),
                ('target_port_mandatory', models.BooleanField(default=False, editable=False)),
                ('no_default_alpn_mandatory', models.BooleanField(default=False, editable=False)),
                ('zone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dns_grpc.dnszone')),
            ],
            options={
                'verbose_name': 'HTTPS record',
                'verbose_name_plural': 'HTTPS records',
                'ordering': ['record_name'],
                'abstract': False,
            },
        ),
        migrations.AddIndex(
            model_name='httpsrecord',
            index=models.Index(fields=['record_name', 'port', 'zone'], name='dns_grpc_ht_record__613902_idx'),
        ),
    ]
class Migration(migrations.Migration):

    replaces = [('support', '0001_initial'), ('support', '0002_auto_20200929_1559'), ('support', '0003_ticket_assigned_to'), ('support', '0004_auto_20201002_0819'), ('support', '0005_ticketmessage_email_message_id'), ('support', '0006_auto_20201014_1703')]

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('full_name', models.CharField(max_length=255)),
                ('email', models.EmailField(db_index=True, max_length=254)),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)),
                ('phone_ext', models.CharField(blank=True, max_length=64, null=True, verbose_name='Phone extension')),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Ticket',
            fields=[
                ('id', as207960_utils.models.TypedUUIDField(data_type='support_ticket', primary_key=True, serialize=False)),
                ('ref', models.CharField(db_index=True, default=support.models.make_ticket_ref, max_length=64)),
                ('state', models.CharField(choices=[('O', 'Open'), ('C', 'Closed')], default='O', max_length=1)),
                ('source', models.CharField(choices=[('P', 'Phone'), ('W', 'Web'), ('E', 'Email'), ('O', 'Other')], default='O', max_length=1)),
                ('priority', models.CharField(choices=[('L', 'Low'), ('N', 'Normal'), ('H', 'High'), ('E', 'Emergency')], default='N', max_length=1)),
                ('due_date', models.DateTimeField(blank=True, null=True)),
                ('subject', models.CharField(max_length=255)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='support.customer')),
                ('assigned_to', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('customer_verified', models.BooleanField(blank=True, default=False)),
                ('verification_token', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='TicketMessage',
            fields=[
                ('id', as207960_utils.models.TypedUUIDField(data_type='support_ticketmessage', primary_key=True, serialize=False)),
                ('type', models.CharField(choices=[('C', 'Customer'), ('R', 'Response'), ('N', 'Note'), ('S', 'System')], max_length=1)),
                ('date', models.DateTimeField()),
                ('message', models.TextField()),
                ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='support.ticket')),
                ('email_message_id', models.TextField(blank=True, null=True)),
            ],
            options={
                'ordering': ['date'],
            },
        ),
        migrations.CreateModel(
            name='TicketMessageAttachment',
            fields=[
                ('id', as207960_utils.models.TypedUUIDField(data_type='support_ticketattachment', primary_key=True, serialize=False)),
                ('file_name', models.TextField(blank=True, null=True)),
                ('file', models.FileField(upload_to='')),
                ('message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='support.ticketmessage')),
            ],
        ),
    ]
Exemple #6
0
class Ticket(models.Model):
    STATE_OPEN = "O"
    STATE_CLOSED = "C"
    STATES = ((STATE_OPEN, "Open"), (STATE_CLOSED, "Closed"))

    SOURCE_PHONE = "P"
    SOURCE_WEB = "W"
    SOURCE_EMAIL = "E"
    SOURCE_OTHER = "O"
    SOURCES = ((SOURCE_PHONE, "Phone"), (SOURCE_WEB, "Web"),
               (SOURCE_EMAIL, "Email"), (SOURCE_OTHER, "Other"))

    PRIORITY_LOW = "L"
    PRIORITY_NORMAL = "N"
    PRIORITY_HIGH = "H"
    PRIORITY_EMERGENCY = "E"
    PRIORITIES = (
        (PRIORITY_LOW, "Low"),
        (PRIORITY_NORMAL, "Normal"),
        (PRIORITY_HIGH, "High"),
        (PRIORITY_EMERGENCY, "Emergency"),
    )

    id = as207960_utils.models.TypedUUIDField("support_ticket",
                                              primary_key=True)
    ref = models.CharField(max_length=64,
                           db_index=True,
                           default=make_ticket_ref)
    customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
    customer_verified = models.BooleanField(blank=True,
                                            null=False,
                                            default=False)
    verification_token = models.TextField(blank=True, null=True)
    state = models.CharField(max_length=1, choices=STATES, default=STATE_OPEN)
    source = models.CharField(max_length=1,
                              choices=SOURCES,
                              default=SOURCE_OTHER)
    priority = models.CharField(max_length=1,
                                choices=PRIORITIES,
                                default=PRIORITY_NORMAL)
    assigned_to = models.ForeignKey(settings.AUTH_USER_MODEL,
                                    on_delete=models.SET_NULL,
                                    blank=True,
                                    null=True)
    due_date = models.DateTimeField(blank=True, null=True)
    subject = models.CharField(max_length=255)

    def last_message(self):
        return self.messages.filter(
            type=TicketMessage.TYPE_CUSTOMER).order_by('-date').first()

    def last_response(self):
        return self.messages.filter(
            type=TicketMessage.TYPE_RESPONSE).order_by('-date').first()

    def last_message_id(self):
        last_message = self.messages.filter(
            email_message_id__isnull=False).order_by('-date').first()
        if last_message:
            return last_message.email_message_id
        return None

    def message_ids(self):
        return list(
            self.messages.filter(
                email_message_id__isnull=False).order_by('-date').values_list(
                    'email_message_id', flat=True))
Exemple #7
0
class TicketMessageAttachment(models.Model):
    id = as207960_utils.models.TypedUUIDField("support_ticketattachment",
                                              primary_key=True)
    message = models.ForeignKey(TicketMessage, on_delete=models.CASCADE)
    file_name = models.TextField(blank=True, null=True)
    file = models.FileField()
Exemple #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('full_name', models.CharField(max_length=255)),
                ('email', models.EmailField(db_index=True, max_length=254)),
                ('phone',
                 phonenumber_field.modelfields.PhoneNumberField(blank=True,
                                                                max_length=128,
                                                                null=True,
                                                                region=None)),
                ('phone_ext',
                 models.CharField(blank=True,
                                  max_length=64,
                                  null=True,
                                  verbose_name='Phone extension')),
                ('user',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Ticket',
            fields=[
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='support_ticket',
                     primary_key=True,
                     serialize=False)),
                ('ref',
                 models.CharField(db_index=True, max_length=64, null=True)),
                ('state',
                 models.CharField(choices=[('O', 'Open'), ('C', 'Closed')],
                                  default='O',
                                  max_length=1)),
                ('source',
                 models.CharField(choices=[('P', 'Phone'), ('W', 'Web'),
                                           ('E', 'Email'), ('O', 'Other')],
                                  default='O',
                                  max_length=1)),
                ('priority',
                 models.CharField(choices=[('L', 'Low'), ('N', 'Normal')],
                                  default='N',
                                  max_length=1)),
                ('due_date', models.DateTimeField(blank=True, null=True)),
                ('subject', models.CharField(max_length=255)),
                ('customer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='support.customer')),
            ],
        ),
        migrations.CreateModel(
            name='TicketMessage',
            fields=[
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='support_ticketmessage',
                     primary_key=True,
                     serialize=False)),
                ('type',
                 models.CharField(choices=[('C', 'Customer'),
                                           ('R', 'Response'), ('N', 'Note'),
                                           ('S', 'System')],
                                  max_length=1)),
                ('date', models.DateTimeField()),
                ('message', models.TextField()),
                ('ticket',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='support.ticket')),
            ],
        ),
        migrations.CreateModel(
            name='TicketMessageAttachment',
            fields=[
                ('id',
                 as207960_utils.models.TypedUUIDField(
                     data_type='support_ticketattachment',
                     primary_key=True,
                     serialize=False)),
                ('file_name', models.TextField(blank=True, null=True)),
                ('file', models.FileField(upload_to='')),
                ('message',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='support.ticketmessage')),
            ],
        ),
    ]