class Customer(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, blank=True, null=True) full_name = models.CharField(max_length=255) email = models.EmailField(db_index=True) phone = PhoneNumberField(blank=True, null=True) phone_ext = models.CharField(max_length=64, blank=True, null=True, verbose_name="Phone extension") def save(self, *args, **kwargs): if self.user: self.full_name = f"{self.user.first_name} {self.user.last_name}" self.email = self.user.email super().save(*args, **kwargs) @classmethod def get_by_email(cls, email, name=None): customer = Customer.objects.filter(email=email).first() if customer: return customer else: customer = Customer.objects.create(email=email, full_name=name) return customer
class Migration(migrations.Migration): dependencies = [ ('dns_grpc', '0011_auto_20210414_2108'), ] operations = [ migrations.AlterModelOptions( name='githubinstallation', options={'verbose_name': 'GitHub installation'}, ), migrations.AlterModelOptions( name='githubstate', options={'verbose_name': 'GitHub state'}, ), migrations.CreateModel( name='GitHubPagesRecord', 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)')), ('id', as207960_utils.models.TypedUUIDField( data_type='hexdns_githubpagesrecord', primary_key=True, serialize=False)), ('repo_owner', models.CharField(blank=True, max_length=255, null=True)), ('repo_name', models.CharField(blank=True, max_length=255, null=True)), ('zone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dns_grpc.dnszone')), ], options={ 'verbose_name': 'GitHub Pages record', 'verbose_name_plural': 'GitHub Pages records', }, ), migrations.AddIndex( model_name='githubpagesrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_gi_record__9be530_idx'), ), ]
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'], }, ), ]
class Migration(migrations.Migration): dependencies = [ ('dns_grpc', '0017_dnszoneupdatesecrets_restrict_to'), ] operations = [ migrations.CreateModel( name='DNSZoneCustomNS', fields=[ ('id', as207960_utils.models.TypedUUIDField(data_type='hexdns_zonecustomns', primary_key=True, serialize=False)), ('nameserver', models.CharField(max_length=255, verbose_name='Name server')), ('dns_zone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='custom_ns', to='dns_grpc.dnszone')), ], ), ]
class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('oauth', '0002_oauthclient_realm'), ] operations = [ migrations.CreateModel( name='PersonalAccessToken', fields=[ ('id', as207960_utils.models.TypedUUIDField(data_type='oauth_pat', primary_key=True, serialize=False)), ('revoked', models.BooleanField(blank=True)), ('name', models.CharField(max_length=255)), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ]
class Migration(migrations.Migration): dependencies = [ ('dns_grpc', '0015_googleinstallation_googlestate'), ] operations = [ migrations.CreateModel( name='RedirectRecord', 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)')), ('id', as207960_utils.models.TypedUUIDField( data_type='hexdns_zoneredirectrecord', primary_key=True, serialize=False)), ('target', models.URLField()), ('include_path', models.BooleanField(blank=True)), ('zone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dns_grpc.dnszone')), ], options={ 'verbose_name': 'Redirect record', 'verbose_name_plural': 'Redirect records', 'ordering': ['record_name'], 'abstract': False, }, ), migrations.AddIndex( model_name='redirectrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_re_record__b6ce3b_idx'), ), ]
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): dependencies = [ ('dns_grpc', '0002_auto_20200810_1112'), ] operations = [ migrations.CreateModel( name='DNSZoneUpdateSecrets', fields=[ ('id', as207960_utils.models.TypedUUIDField( data_type='hexdns_zoneupdatesecret', primary_key=True, serialize=False)), ('type', models.CharField(choices=[('U', 'Unlimited access'), ('D', 'ACME DNS01 access')], max_length=1)), ('secret', models.BinaryField( default=dns_grpc.models.make_update_secret)), ], ), migrations.RemoveIndex( model_name='anamerecord', name='dns_grpc_an_record__22ca60_idx', ), migrations.RemoveIndex( model_name='caarecord', name='dns_grpc_ca_record__22ca60_idx', ), migrations.RemoveIndex( model_name='cnamerecord', name='dns_grpc_cn_record__22ca60_idx', ), migrations.RemoveIndex( model_name='dsrecord', name='dns_grpc_ds_record__22ca60_idx', ), migrations.RemoveIndex( model_name='hinforecord', name='dns_grpc_hi_record__22ca60_idx', ), migrations.RemoveIndex( model_name='locrecord', name='dns_grpc_lo_record__22ca60_idx', ), migrations.RemoveIndex( model_name='mxrecord', name='dns_grpc_mx_record__22ca60_idx', ), migrations.RemoveIndex( model_name='naptrrecord', name='dns_grpc_na_record__22ca60_idx', ), migrations.RemoveIndex( model_name='nsrecord', name='dns_grpc_ns_record__22ca60_idx', ), migrations.RemoveIndex( model_name='rprecord', name='dns_grpc_rp_record__22ca60_idx', ), migrations.RemoveIndex( model_name='srvrecord', name='dns_grpc_sr_record__22ca60_idx', ), migrations.RemoveIndex( model_name='sshfprecord', name='dns_grpc_sp_record__22ca60_idx', ), migrations.RemoveIndex( model_name='txtrecord', name='dns_grpc_tx_record__22ca60_idx', ), migrations.AlterField( model_name='account', name='subscription_id', field=models.CharField(blank=True, max_length=255, null=True), ), migrations.AlterField( model_name='addressrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zoneaddressrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='anamerecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zoneanamerecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='caarecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonecaarecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='cnamerecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonecnamerecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='dnszone', name='id', field=as207960_utils.models.TypedUUIDField(data_type='hexdns_zone', primary_key=True, serialize=False), ), migrations.AlterField( model_name='dnszone', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='dsrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonedsrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='dynamicaddressrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonedynamicaddressrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='hinforecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonehinforecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='locrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonelocrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='mxrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonemxrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='naptrrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonenaptrrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='nsrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonensrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='ptrrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_rzoneptrrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='reversednszone', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_rzone', primary_key=True, serialize=False), ), migrations.AlterField( model_name='reversednszone', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='reversensrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_rzonensrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='rprecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonerprecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='secondarydnszone', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_szone', primary_key=True, serialize=False), ), migrations.AlterField( model_name='secondarydnszone', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='secondarydnszonerecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_szonerecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='srvrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonesrvrecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='sshfprecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonesshfprecord', primary_key=True, serialize=False), ), migrations.AlterField( model_name='txtrecord', name='id', field=as207960_utils.models.TypedUUIDField( data_type='hexdns_zonetxtrecord', primary_key=True, serialize=False), ), migrations.AddIndex( model_name='anamerecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_an_record__5ccb6f_idx'), ), migrations.AddIndex( model_name='caarecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_ca_record__9643d5_idx'), ), migrations.AddIndex( model_name='cnamerecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_cn_record__f5504e_idx'), ), migrations.AddIndex( model_name='dsrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_ds_record__9da5be_idx'), ), migrations.AddIndex( model_name='hinforecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_hi_record__18a0ad_idx'), ), migrations.AddIndex( model_name='locrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_lo_record__30d955_idx'), ), migrations.AddIndex( model_name='mxrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_mx_record__7ff6a7_idx'), ), migrations.AddIndex( model_name='naptrrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_na_record__049650_idx'), ), migrations.AddIndex( model_name='nsrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_ns_record__222ed0_idx'), ), migrations.AddIndex( model_name='ptrrecord', index=models.Index(fields=['record_address', 'zone'], name='dns_grpc_pt_record__3b0725_idx'), ), migrations.AddIndex( model_name='reversensrecord', index=models.Index(fields=['record_address', 'zone'], name='dns_grpc_re_record__7008f0_idx'), ), migrations.AddIndex( model_name='rprecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_rp_record__f0da2e_idx'), ), migrations.AddIndex( model_name='srvrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_sr_record__9e774f_idx'), ), migrations.AddIndex( model_name='sshfprecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_ss_record__60fc0a_idx'), ), migrations.AddIndex( model_name='txtrecord', index=models.Index(fields=['record_name', 'zone'], name='dns_grpc_tx_record__8ef4d2_idx'), ), migrations.AddField( model_name='dnszoneupdatesecrets', name='zone', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to='dns_grpc.dnszone'), ), ]
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')), ], ), ]
class Migration(migrations.Migration): dependencies = [ ('domains', '0038_auto_20200722_2146'), ] operations = [ migrations.AlterField( model_name='contact', name='description', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='contact', name='email', field=models.EmailField(max_length=254), ), migrations.AlterField( model_name='contact', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_contact', primary_key=True, serialize=False), ), migrations.AlterField( model_name='contact', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='contactaddress', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_contactaddress', primary_key=True, serialize=False), ), migrations.AlterField( model_name='contactaddress', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='domainregistration', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainregistration', primary_key=True, serialize=False), ), migrations.AlterField( model_name='domainregistration', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='domainregistrationorder', name='auth_info', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='domainregistrationorder', name='domain_id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainregistration'), ), migrations.AlterField( model_name='domainregistrationorder', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainregistrationorder', primary_key=True, serialize=False), ), migrations.AlterField( model_name='domainregistrationorder', name='price', field=models.DecimalField(decimal_places=2, max_digits=9), ), migrations.AlterField( model_name='domainregistrationorder', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='domainreneworder', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainreneworder', primary_key=True, serialize=False), ), migrations.AlterField( model_name='domainreneworder', name='price', field=models.DecimalField(decimal_places=2, max_digits=9), ), migrations.AlterField( model_name='domainreneworder', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='domainrestoreorder', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainrestoreorder', primary_key=True, serialize=False), ), migrations.AlterField( model_name='domainrestoreorder', name='price', field=models.DecimalField(decimal_places=2, max_digits=9), ), migrations.AlterField( model_name='domainrestoreorder', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='domaintransferorder', name='domain_id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domainregistration'), ), migrations.AlterField( model_name='domaintransferorder', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_domaintransferorder', primary_key=True, serialize=False), ), migrations.AlterField( model_name='domaintransferorder', name='price', field=models.DecimalField(decimal_places=2, max_digits=9), ), migrations.AlterField( model_name='domaintransferorder', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), migrations.AlterField( model_name='hangoutsuserlinkstate', name='message_name', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='nameserver', name='id', field=as207960_utils.models.TypedUUIDField( data_type='domains_nameserver', primary_key=True, serialize=False), ), migrations.AlterField( model_name='nameserver', name='registry_id', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='nameserver', name='resource_id', field=models.UUIDField(db_index=True, null=True), ), ]
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))
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')), ], ), ]