implement model changes
- add new domains.apps.AppConfig to allow translatable app description for domains app - link domains to a customer - extract common functionality from domains.models.MailDomain into abstract domains.models.DomainBase - add separate domains.models.HostingDomain to allow for generic external domains - add new hostingpackages.models.CustomerHostingPackageDomain to assign hosting domains to hosting packages
This commit is contained in:
parent
a3e3e2a76f
commit
0c291f0510
6 changed files with 177 additions and 2 deletions
|
@ -14,6 +14,7 @@ from django.utils.translation import ugettext_lazy as _, ungettext
|
|||
from model_utils import Choices
|
||||
from model_utils.models import TimeStampedModel
|
||||
|
||||
from domains.models import HostingDomain
|
||||
from managemails.models import Mailbox
|
||||
from osusers.models import (
|
||||
AdditionalGroup,
|
||||
|
@ -66,6 +67,7 @@ class HostingOption(TimeStampedModel):
|
|||
|
||||
"""
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class DiskSpaceOptionBase(models.Model):
|
||||
diskspace = models.PositiveIntegerField(_('disk space'))
|
||||
|
@ -83,6 +85,7 @@ class DiskSpaceOptionBase(models.Model):
|
|||
return _("Additional disk space {space} {unit}").format(
|
||||
space=self.diskspace, unit=self.get_diskspace_unit_display())
|
||||
|
||||
|
||||
class DiskSpaceOption(DiskSpaceOptionBase, HostingOption):
|
||||
"""
|
||||
This is a class for hosting options adding additional disk space to
|
||||
|
@ -329,6 +332,30 @@ class CustomerHostingPackage(HostingPackageBase):
|
|||
return super(CustomerHostingPackage, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CustomerHostingPackageDomain(TimeStampedModel):
|
||||
"""
|
||||
This class defines the relationship from a hosting package to a hosting
|
||||
domain.
|
||||
|
||||
"""
|
||||
hosting_package = models.ForeignKey(
|
||||
CustomerHostingPackage, verbose_name=_('hosting package'),
|
||||
related_name='domains')
|
||||
domain = models.OneToOneField(
|
||||
HostingDomain, verbose_name=_('hosting domain'))
|
||||
|
||||
def __str__(self):
|
||||
return self.domain.domain
|
||||
|
||||
def is_usable_for_email(self):
|
||||
"""
|
||||
Tells wether the related domain is usable for email addresses.
|
||||
|
||||
"""
|
||||
return self.domain.maildomain is not None
|
||||
|
||||
|
||||
class CustomerHostingPackageOption(TimeStampedModel):
|
||||
"""
|
||||
This class defines options for customer hosting packages.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue