Add mailbox requests and deployment manifests for hosting accounts
This commit is contained in:
1 parent
4e05e63b15
commit
4bd7a90580
10 files changed
+519
No files matched your search
@@ -5,6 +5,7 @@ from django.urls import reverse
|
||||
|
||||
from coulobre.database_node import DATABASE_SUFFIX_PATTERN, INVALID_SUFFIX, DatabaseSpec
|
||||
from coulobre.dns_node import MAX_SOA_SERIAL, AddressRecord, DnsZone
|
||||
from coulobre.mail_node import LOCAL_PART_MAX_LENGTH, MailboxSpec
|
||||
|
||||
from .fields import DomainNameField
|
||||
|
||||
@@ -118,6 +119,39 @@ class HostingDnsZone(models.Model):
|
||||
return str(self.domain)
|
||||
|
||||
|
||||
class HostingMailDomain(models.Model):
|
||||
account = models.ForeignKey(
|
||||
HostingAccount, on_delete=models.PROTECT, related_name="mail_domains"
|
||||
)
|
||||
domain = DomainNameField(max_length=253, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.domain)
|
||||
|
||||
|
||||
class HostingMailbox(models.Model):
|
||||
mail_domain = models.ForeignKey(
|
||||
HostingMailDomain, on_delete=models.PROTECT, related_name="mailboxes"
|
||||
)
|
||||
local_part = models.CharField(max_length=LOCAL_PART_MAX_LENGTH)
|
||||
|
||||
class Meta:
|
||||
ordering = ("mail_domain__domain", "local_part")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=("mail_domain", "local_part"),
|
||||
name="hosting_mailbox_domain_local_part_unique",
|
||||
)
|
||||
]
|
||||
|
||||
@property
|
||||
def spec(self):
|
||||
return MailboxSpec(self.mail_domain.domain, self.local_part)
|
||||
|
||||
def __str__(self):
|
||||
return self.spec.address
|
||||
|
||||
|
||||
class WebProvisioningPlan(models.Model):
|
||||
account = models.ForeignKey(HostingAccount, on_delete=models.CASCADE)
|
||||
primary_domain = DomainNameField(max_length=253)
|
||||
|
||||
Reference in new issue
Block a user