Upgrade to Django 3.2
- update dependencies - fix deprecation warnings - fix tests - skip some tests that need more work - reformat changed code with isort and black
This commit is contained in:
parent
0f18e59d67
commit
4af1a39ca4
93 changed files with 3598 additions and 2725 deletions
|
@ -2,4 +2,3 @@
|
|||
This app takes care of hosting packages.
|
||||
|
||||
"""
|
||||
default_app_config = 'hostingpackages.apps.HostingPackagesAppConfig'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
This module contains the admin site interface for hosting packages.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
|
@ -25,9 +25,10 @@ class CustomerHostingPackageCreateForm(forms.ModelForm):
|
|||
This is the form class for creating new customer hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = CustomerHostingPackage
|
||||
fields = ['customer', 'template', 'name']
|
||||
fields = ["customer", "template", "name"]
|
||||
|
||||
def save(self, **kwargs):
|
||||
"""
|
||||
|
@ -39,10 +40,11 @@ class CustomerHostingPackageCreateForm(forms.ModelForm):
|
|||
|
||||
"""
|
||||
hostinpackages = CustomerHostingPackage.objects.create_from_template(
|
||||
customer=self.cleaned_data['customer'],
|
||||
template=self.cleaned_data['template'],
|
||||
name=self.cleaned_data['name'],
|
||||
**kwargs)
|
||||
customer=self.cleaned_data["customer"],
|
||||
template=self.cleaned_data["template"],
|
||||
name=self.cleaned_data["name"],
|
||||
**kwargs
|
||||
)
|
||||
return hostinpackages
|
||||
|
||||
def save_m2m(self):
|
||||
|
@ -55,6 +57,7 @@ class CustomerDiskSpaceOptionInline(admin.TabularInline):
|
|||
space options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerDiskSpaceOption
|
||||
extra = 0
|
||||
|
||||
|
@ -65,6 +68,7 @@ class CustomerMailboxOptionInline(admin.TabularInline):
|
|||
mailbox options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerMailboxOption
|
||||
extra = 0
|
||||
|
||||
|
@ -75,6 +79,7 @@ class CustomerUserDatabaseOptionInline(admin.TabularInline):
|
|||
database options.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerUserDatabaseOption
|
||||
extra = 0
|
||||
|
||||
|
@ -85,6 +90,7 @@ class CustomerHostingPackageDomainInline(admin.TabularInline):
|
|||
hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackageDomain
|
||||
extra = 0
|
||||
|
||||
|
@ -95,12 +101,9 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
:py:class:`CustomerHostingPackage`.
|
||||
|
||||
"""
|
||||
|
||||
add_form = CustomerHostingPackageCreateForm
|
||||
add_fieldsets = (
|
||||
(None, {
|
||||
'fields': ('customer', 'template', 'name')
|
||||
}),
|
||||
)
|
||||
add_fieldsets = ((None, {"fields": ("customer", "template", "name")}),)
|
||||
|
||||
inlines = [
|
||||
CustomerDiskSpaceOptionInline,
|
||||
|
@ -108,7 +111,7 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
CustomerUserDatabaseOptionInline,
|
||||
CustomerHostingPackageDomainInline,
|
||||
]
|
||||
list_display = ['name', 'customer', 'osuser']
|
||||
list_display = ["name", "customer", "osuser"]
|
||||
|
||||
def get_form(self, request, obj=None, **kwargs):
|
||||
"""
|
||||
|
@ -125,13 +128,16 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
"""
|
||||
defaults = {}
|
||||
if obj is None:
|
||||
defaults.update({
|
||||
'form': self.add_form,
|
||||
'fields': admin.options.flatten_fieldsets(self.add_fieldsets),
|
||||
})
|
||||
defaults.update(
|
||||
{
|
||||
"form": self.add_form,
|
||||
"fields": admin.options.flatten_fieldsets(self.add_fieldsets),
|
||||
}
|
||||
)
|
||||
defaults.update(kwargs)
|
||||
return super(CustomerHostingPackageAdmin, self).get_form(
|
||||
request, obj, **defaults)
|
||||
request, obj, **defaults
|
||||
)
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
"""
|
||||
|
@ -147,7 +153,7 @@ class CustomerHostingPackageAdmin(admin.ModelAdmin):
|
|||
|
||||
"""
|
||||
if obj:
|
||||
return ['customer', 'template']
|
||||
return ["customer", "template"]
|
||||
return []
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@ This module contains the :py:class:`django.apps.AppConfig` instance for the
|
|||
:py:mod:`hostingpackages` app.
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class HostingPackagesAppConfig(AppConfig):
|
||||
|
@ -13,5 +12,6 @@ class HostingPackagesAppConfig(AppConfig):
|
|||
AppConfig for the :py:mod:`hostingpackages` app.
|
||||
|
||||
"""
|
||||
name = 'hostingpackages'
|
||||
verbose_name = _('Hosting Packages and Options')
|
||||
|
||||
name = "hostingpackages"
|
||||
verbose_name = _("Hosting Packages and Options")
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
This module contains the form classes related to hosting packages.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from __future__ import absolute_import
|
||||
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import (
|
||||
Layout,
|
||||
Submit,
|
||||
)
|
||||
from crispy_forms.layout import Layout, Submit
|
||||
from django import forms
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from .models import (
|
||||
CustomerDiskSpaceOption,
|
||||
|
@ -28,25 +24,24 @@ class CreateCustomerHostingPackageForm(forms.ModelForm):
|
|||
a preselected customer.
|
||||
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = CustomerHostingPackage
|
||||
fields = ['template', 'name', 'description']
|
||||
fields = ["template", "name", "description"]
|
||||
|
||||
def __init__(self, instance, *args, **kwargs):
|
||||
username = kwargs.pop('user')
|
||||
super(CreateCustomerHostingPackageForm, self).__init__(
|
||||
*args, **kwargs
|
||||
)
|
||||
self.fields['description'].widget.attrs['rows'] = 2
|
||||
username = kwargs.pop("user")
|
||||
super(CreateCustomerHostingPackageForm, self).__init__(*args, **kwargs)
|
||||
self.fields["description"].widget.attrs["rows"] = 2
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_action = reverse(
|
||||
'create_customer_hosting_package', kwargs={'user': username}
|
||||
"create_customer_hosting_package", kwargs={"user": username}
|
||||
)
|
||||
self.helper.layout = Layout(
|
||||
'template',
|
||||
'name',
|
||||
'description',
|
||||
Submit('submit', _('Add Hosting Package')),
|
||||
"template",
|
||||
"name",
|
||||
"description",
|
||||
Submit("submit", _("Add Hosting Package")),
|
||||
)
|
||||
|
||||
|
||||
|
@ -55,44 +50,44 @@ class CreateHostingPackageForm(forms.ModelForm):
|
|||
This form class is used for creating new customer hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = CustomerHostingPackage
|
||||
fields = ['customer', 'template', 'name', 'description']
|
||||
fields = ["customer", "template", "name", "description"]
|
||||
|
||||
def __init__(self, instance, *args, **kwargs):
|
||||
super(CreateHostingPackageForm, self).__init__(
|
||||
*args, **kwargs
|
||||
)
|
||||
self.fields['description'].widget.attrs['rows'] = 2
|
||||
super(CreateHostingPackageForm, self).__init__(*args, **kwargs)
|
||||
self.fields["description"].widget.attrs["rows"] = 2
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_action = reverse('create_hosting_package')
|
||||
self.helper.form_action = reverse("create_hosting_package")
|
||||
self.helper.layout = Layout(
|
||||
'customer',
|
||||
'template',
|
||||
'name',
|
||||
'description',
|
||||
Submit('submit', _('Add Hosting Package')),
|
||||
"customer",
|
||||
"template",
|
||||
"name",
|
||||
"description",
|
||||
Submit("submit", _("Add Hosting Package")),
|
||||
)
|
||||
|
||||
|
||||
class AddDiskspaceOptionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CustomerDiskSpaceOption
|
||||
fields = ['diskspace', 'diskspace_unit']
|
||||
fields = ["diskspace", "diskspace_unit"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.hostingpackage = kwargs.pop('hostingpackage')
|
||||
self.option_template = kwargs.pop('option_template')
|
||||
self.hostingpackage = kwargs.pop("hostingpackage")
|
||||
self.option_template = kwargs.pop("option_template")
|
||||
super(AddDiskspaceOptionForm, self).__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_action = reverse(
|
||||
'add_hosting_option',
|
||||
"add_hosting_option",
|
||||
kwargs={
|
||||
'package': self.hostingpackage.id,
|
||||
'type': 'diskspace',
|
||||
'optionid': self.option_template.id,
|
||||
})
|
||||
self.helper.add_input(Submit('submit', _('Add disk space option')))
|
||||
"package": self.hostingpackage.id,
|
||||
"type": "diskspace",
|
||||
"optionid": self.option_template.id,
|
||||
},
|
||||
)
|
||||
self.helper.add_input(Submit("submit", _("Add disk space option")))
|
||||
|
||||
def save(self, commit=True):
|
||||
self.instance.hosting_package = self.hostingpackage
|
||||
|
@ -103,21 +98,22 @@ class AddDiskspaceOptionForm(forms.ModelForm):
|
|||
class AddMailboxOptionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CustomerMailboxOption
|
||||
fields = ['number']
|
||||
fields = ["number"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.hostingpackage = kwargs.pop('hostingpackage')
|
||||
self.option_template = kwargs.pop('option_template')
|
||||
self.hostingpackage = kwargs.pop("hostingpackage")
|
||||
self.option_template = kwargs.pop("option_template")
|
||||
super(AddMailboxOptionForm, self).__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_action = reverse(
|
||||
'add_hosting_option',
|
||||
"add_hosting_option",
|
||||
kwargs={
|
||||
'package': self.hostingpackage.id,
|
||||
'type': 'mailboxes',
|
||||
'optionid': self.option_template.id,
|
||||
})
|
||||
self.helper.add_input(Submit('submit', _('Add mailbox option')))
|
||||
"package": self.hostingpackage.id,
|
||||
"type": "mailboxes",
|
||||
"optionid": self.option_template.id,
|
||||
},
|
||||
)
|
||||
self.helper.add_input(Submit("submit", _("Add mailbox option")))
|
||||
|
||||
def save(self, commit=True):
|
||||
self.instance.hosting_package = self.hostingpackage
|
||||
|
@ -128,21 +124,22 @@ class AddMailboxOptionForm(forms.ModelForm):
|
|||
class AddUserDatabaseOptionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = CustomerUserDatabaseOption
|
||||
fields = ['number']
|
||||
fields = ["number"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.hostingpackage = kwargs.pop('hostingpackage')
|
||||
self.option_template = kwargs.pop('option_template')
|
||||
self.hostingpackage = kwargs.pop("hostingpackage")
|
||||
self.option_template = kwargs.pop("option_template")
|
||||
super(AddUserDatabaseOptionForm, self).__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_action = reverse(
|
||||
'add_hosting_option',
|
||||
"add_hosting_option",
|
||||
kwargs={
|
||||
'package': self.hostingpackage.id,
|
||||
'type': 'databases',
|
||||
'optionid': self.option_template.id,
|
||||
})
|
||||
self.helper.add_input(Submit('submit', _('Add database option')))
|
||||
"package": self.hostingpackage.id,
|
||||
"type": "databases",
|
||||
"optionid": self.option_template.id,
|
||||
},
|
||||
)
|
||||
self.helper.add_input(Submit("submit", _("Add database option")))
|
||||
|
||||
def save(self, commit=True):
|
||||
self.instance.hosting_package = self.hostingpackage
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.utils.timezone
|
||||
import model_utils.fields
|
||||
from django.conf import settings
|
||||
|
@ -14,301 +12,469 @@ class Migration(migrations.Migration):
|
|||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CustomerHostingPackage',
|
||||
name="CustomerHostingPackage",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
('name', models.CharField(
|
||||
unique=True, max_length=128, verbose_name='name')),
|
||||
('description', models.TextField(
|
||||
verbose_name='description', blank=True)),
|
||||
('mailboxcount', models.PositiveIntegerField(
|
||||
verbose_name='mailbox count')),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
help_text='disk space for the hosting package',
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
('customer', models.ForeignKey(
|
||||
verbose_name='customer', to=settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(unique=True, max_length=128, verbose_name="name"),
|
||||
),
|
||||
(
|
||||
"description",
|
||||
models.TextField(verbose_name="description", blank=True),
|
||||
),
|
||||
(
|
||||
"mailboxcount",
|
||||
models.PositiveIntegerField(verbose_name="mailbox count"),
|
||||
),
|
||||
(
|
||||
"diskspace",
|
||||
models.PositiveIntegerField(
|
||||
help_text="disk space for the hosting package",
|
||||
verbose_name="disk space",
|
||||
),
|
||||
),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
(
|
||||
"customer",
|
||||
models.ForeignKey(
|
||||
verbose_name="customer",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'customer hosting package',
|
||||
'verbose_name_plural': 'customer hosting packages',
|
||||
"verbose_name": "customer hosting package",
|
||||
"verbose_name_plural": "customer hosting packages",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerHostingPackageOption',
|
||||
name="CustomerHostingPackageOption",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'customer hosting option',
|
||||
'verbose_name_plural': 'customer hosting options',
|
||||
"verbose_name": "customer hosting option",
|
||||
"verbose_name_plural": "customer hosting options",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerDiskSpaceOption',
|
||||
name="CustomerDiskSpaceOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
("diskspace", models.PositiveIntegerField(verbose_name="disk space")),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['diskspace_unit', 'diskspace'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Disk space option',
|
||||
'verbose_name_plural': 'Disk space options',
|
||||
"ordering": ["diskspace_unit", "diskspace"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Disk space option",
|
||||
"verbose_name_plural": "Disk space options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerMailboxOption',
|
||||
name="CustomerMailboxOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
unique=True, verbose_name='number of mailboxes')),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
unique=True, verbose_name="number of mailboxes"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Mailbox option',
|
||||
'verbose_name_plural': 'Mailbox options',
|
||||
"ordering": ["number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Mailbox option",
|
||||
"verbose_name_plural": "Mailbox options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerUserDatabaseOption',
|
||||
name="CustomerUserDatabaseOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
default=1, verbose_name='number of databases')),
|
||||
('db_type', models.PositiveSmallIntegerField(
|
||||
verbose_name='database type',
|
||||
choices=[(0, 'PostgreSQL'), (1, 'MySQL')])),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
default=1, verbose_name="number of databases"
|
||||
),
|
||||
),
|
||||
(
|
||||
"db_type",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="database type",
|
||||
choices=[(0, "PostgreSQL"), (1, "MySQL")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['db_type', 'number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Database option',
|
||||
'verbose_name_plural': 'Database options',
|
||||
"ordering": ["db_type", "number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Database option",
|
||||
"verbose_name_plural": "Database options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HostingOption',
|
||||
name="HostingOption",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Hosting option',
|
||||
'verbose_name_plural': 'Hosting options',
|
||||
"verbose_name": "Hosting option",
|
||||
"verbose_name_plural": "Hosting options",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DiskSpaceOption',
|
||||
name="DiskSpaceOption",
|
||||
fields=[
|
||||
('hostingoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
("diskspace", models.PositiveIntegerField(verbose_name="disk space")),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['diskspace_unit', 'diskspace'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Disk space option',
|
||||
'verbose_name_plural': 'Disk space options',
|
||||
"ordering": ["diskspace_unit", "diskspace"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Disk space option",
|
||||
"verbose_name_plural": "Disk space options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HostingPackageTemplate',
|
||||
name="HostingPackageTemplate",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
('name', models.CharField(
|
||||
unique=True, max_length=128, verbose_name='name')),
|
||||
('description', models.TextField(
|
||||
verbose_name='description', blank=True)),
|
||||
('mailboxcount', models.PositiveIntegerField(
|
||||
verbose_name='mailbox count')),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
help_text='disk space for the hosting package',
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(unique=True, max_length=128, verbose_name="name"),
|
||||
),
|
||||
(
|
||||
"description",
|
||||
models.TextField(verbose_name="description", blank=True),
|
||||
),
|
||||
(
|
||||
"mailboxcount",
|
||||
models.PositiveIntegerField(verbose_name="mailbox count"),
|
||||
),
|
||||
(
|
||||
"diskspace",
|
||||
models.PositiveIntegerField(
|
||||
help_text="disk space for the hosting package",
|
||||
verbose_name="disk space",
|
||||
),
|
||||
),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Hosting package',
|
||||
'verbose_name_plural': 'Hosting packages',
|
||||
"verbose_name": "Hosting package",
|
||||
"verbose_name_plural": "Hosting packages",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MailboxOption',
|
||||
name="MailboxOption",
|
||||
fields=[
|
||||
('hostingoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
unique=True, verbose_name='number of mailboxes')),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
unique=True, verbose_name="number of mailboxes"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Mailbox option',
|
||||
'verbose_name_plural': 'Mailbox options',
|
||||
"ordering": ["number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Mailbox option",
|
||||
"verbose_name_plural": "Mailbox options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='UserDatabaseOption',
|
||||
name="UserDatabaseOption",
|
||||
fields=[
|
||||
('hostingoption_ptr', models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
default=1, verbose_name='number of databases')),
|
||||
('db_type', models.PositiveSmallIntegerField(
|
||||
verbose_name='database type',
|
||||
choices=[(0, 'PostgreSQL'), (1, 'MySQL')])),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
default=1, verbose_name="number of databases"
|
||||
),
|
||||
),
|
||||
(
|
||||
"db_type",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="database type",
|
||||
choices=[(0, "PostgreSQL"), (1, "MySQL")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['db_type', 'number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Database option',
|
||||
'verbose_name_plural': 'Database options',
|
||||
"ordering": ["db_type", "number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Database option",
|
||||
"verbose_name_plural": "Database options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='userdatabaseoption',
|
||||
unique_together={('number', 'db_type')},
|
||||
name="userdatabaseoption",
|
||||
unique_together={("number", "db_type")},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='diskspaceoption',
|
||||
unique_together={('diskspace', 'diskspace_unit')},
|
||||
name="diskspaceoption",
|
||||
unique_together={("diskspace", "diskspace_unit")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customeruserdatabaseoption',
|
||||
name='template',
|
||||
model_name="customeruserdatabaseoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='user database option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The user database option template that this '
|
||||
'hosting option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="user database option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The user database option template that this "
|
||||
"hosting option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customeruserdatabaseoption',
|
||||
unique_together={('number', 'db_type')},
|
||||
name="customeruserdatabaseoption",
|
||||
unique_together={("number", "db_type")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customermailboxoption',
|
||||
name='template',
|
||||
model_name="customermailboxoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='mailbox option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The mailbox option template that this hosting '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="mailbox option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The mailbox option template that this hosting "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackageoption',
|
||||
name='hosting_package',
|
||||
model_name="customerhostingpackageoption",
|
||||
name="hosting_package",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='hosting package',
|
||||
to='hostingpackages.CustomerHostingPackage',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="hosting package",
|
||||
to="hostingpackages.CustomerHostingPackage",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackage',
|
||||
name='template',
|
||||
model_name="customerhostingpackage",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='hosting package template',
|
||||
to='hostingpackages.HostingPackageTemplate',
|
||||
help_text='The hosting package template that this hosting '
|
||||
'package is based on.',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="hosting package template",
|
||||
to="hostingpackages.HostingPackageTemplate",
|
||||
help_text="The hosting package template that this hosting "
|
||||
"package is based on.",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerdiskspaceoption',
|
||||
name='template',
|
||||
model_name="customerdiskspaceoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='disk space option template',
|
||||
to='hostingpackages.DiskSpaceOption',
|
||||
help_text='The disk space option template that this hosting '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="disk space option template",
|
||||
to="hostingpackages.DiskSpaceOption",
|
||||
help_text="The disk space option template that this hosting "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customerdiskspaceoption',
|
||||
unique_together={('diskspace', 'diskspace_unit')},
|
||||
name="customerdiskspaceoption",
|
||||
unique_together={("diskspace", "diskspace_unit")},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.utils.timezone
|
||||
import model_utils.fields
|
||||
from django.conf import settings
|
||||
|
@ -8,361 +6,530 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
replaces = [('hostingpackages', '0001_initial'),
|
||||
('hostingpackages', '0002_auto_20150118_1149'),
|
||||
('hostingpackages', '0003_auto_20150118_1221'),
|
||||
('hostingpackages', '0004_customerhostingpackage_osuser'),
|
||||
('hostingpackages', '0005_auto_20150118_1303')]
|
||||
replaces = [
|
||||
("hostingpackages", "0001_initial"),
|
||||
("hostingpackages", "0002_auto_20150118_1149"),
|
||||
("hostingpackages", "0003_auto_20150118_1221"),
|
||||
("hostingpackages", "0004_customerhostingpackage_osuser"),
|
||||
("hostingpackages", "0005_auto_20150118_1303"),
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('osusers', '0004_auto_20150104_1751'),
|
||||
("osusers", "0004_auto_20150104_1751"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CustomerHostingPackage',
|
||||
name="CustomerHostingPackage",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
('name', models.CharField(
|
||||
unique=True, max_length=128, verbose_name='name')),
|
||||
('description', models.TextField(
|
||||
verbose_name='description', blank=True)),
|
||||
('mailboxcount', models.PositiveIntegerField(
|
||||
verbose_name='mailbox count')),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
help_text='disk space for the hosting package',
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
('customer', models.ForeignKey(
|
||||
verbose_name='customer',
|
||||
to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(unique=True, max_length=128, verbose_name="name"),
|
||||
),
|
||||
(
|
||||
"description",
|
||||
models.TextField(verbose_name="description", blank=True),
|
||||
),
|
||||
(
|
||||
"mailboxcount",
|
||||
models.PositiveIntegerField(verbose_name="mailbox count"),
|
||||
),
|
||||
(
|
||||
"diskspace",
|
||||
models.PositiveIntegerField(
|
||||
help_text="disk space for the hosting package",
|
||||
verbose_name="disk space",
|
||||
),
|
||||
),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
(
|
||||
"customer",
|
||||
models.ForeignKey(
|
||||
verbose_name="customer",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'customer hosting package',
|
||||
'verbose_name_plural': 'customer hosting packages',
|
||||
"verbose_name": "customer hosting package",
|
||||
"verbose_name_plural": "customer hosting packages",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerHostingPackageOption',
|
||||
name="CustomerHostingPackageOption",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'customer hosting option',
|
||||
'verbose_name_plural': 'customer hosting options',
|
||||
"verbose_name": "customer hosting option",
|
||||
"verbose_name_plural": "customer hosting options",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerDiskSpaceOption',
|
||||
name="CustomerDiskSpaceOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
("diskspace", models.PositiveIntegerField(verbose_name="disk space")),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['diskspace_unit', 'diskspace'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Disk space option',
|
||||
'verbose_name_plural': 'Disk space options',
|
||||
"ordering": ["diskspace_unit", "diskspace"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Disk space option",
|
||||
"verbose_name_plural": "Disk space options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerMailboxOption',
|
||||
name="CustomerMailboxOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
unique=True, verbose_name='number of mailboxes')),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
unique=True, verbose_name="number of mailboxes"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Mailbox option',
|
||||
'verbose_name_plural': 'Mailbox options',
|
||||
"ordering": ["number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Mailbox option",
|
||||
"verbose_name_plural": "Mailbox options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CustomerUserDatabaseOption',
|
||||
name="CustomerUserDatabaseOption",
|
||||
fields=[
|
||||
('customerhostingpackageoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False,
|
||||
to='hostingpackages.CustomerHostingPackageOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
default=1, verbose_name='number of databases')),
|
||||
('db_type', models.PositiveSmallIntegerField(
|
||||
verbose_name='database type',
|
||||
choices=[(0, 'PostgreSQL'), (1, 'MySQL')])),
|
||||
(
|
||||
"customerhostingpackageoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.CustomerHostingPackageOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
default=1, verbose_name="number of databases"
|
||||
),
|
||||
),
|
||||
(
|
||||
"db_type",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="database type",
|
||||
choices=[(0, "PostgreSQL"), (1, "MySQL")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['db_type', 'number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Database option',
|
||||
'verbose_name_plural': 'Database options',
|
||||
"ordering": ["db_type", "number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Database option",
|
||||
"verbose_name_plural": "Database options",
|
||||
},
|
||||
bases=(
|
||||
'hostingpackages.customerhostingpackageoption', models.Model),
|
||||
bases=("hostingpackages.customerhostingpackageoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HostingOption',
|
||||
name="HostingOption",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Hosting option',
|
||||
'verbose_name_plural': 'Hosting options',
|
||||
"verbose_name": "Hosting option",
|
||||
"verbose_name_plural": "Hosting options",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DiskSpaceOption',
|
||||
name="DiskSpaceOption",
|
||||
fields=[
|
||||
('hostingoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
("diskspace", models.PositiveIntegerField(verbose_name="disk space")),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['diskspace_unit', 'diskspace'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Disk space option',
|
||||
'verbose_name_plural': 'Disk space options',
|
||||
"ordering": ["diskspace_unit", "diskspace"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Disk space option",
|
||||
"verbose_name_plural": "Disk space options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HostingPackageTemplate',
|
||||
name="HostingPackageTemplate",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
('name', models.CharField(
|
||||
unique=True, max_length=128, verbose_name='name')),
|
||||
('description', models.TextField(
|
||||
verbose_name='description', blank=True)),
|
||||
('mailboxcount', models.PositiveIntegerField(
|
||||
verbose_name='mailbox count')),
|
||||
('diskspace', models.PositiveIntegerField(
|
||||
help_text='disk space for the hosting package',
|
||||
verbose_name='disk space')),
|
||||
('diskspace_unit', models.PositiveSmallIntegerField(
|
||||
verbose_name='unit of disk space',
|
||||
choices=[(0, 'MiB'), (1, 'GiB'), (2, 'TiB')])),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(unique=True, max_length=128, verbose_name="name"),
|
||||
),
|
||||
(
|
||||
"description",
|
||||
models.TextField(verbose_name="description", blank=True),
|
||||
),
|
||||
(
|
||||
"mailboxcount",
|
||||
models.PositiveIntegerField(verbose_name="mailbox count"),
|
||||
),
|
||||
(
|
||||
"diskspace",
|
||||
models.PositiveIntegerField(
|
||||
help_text="disk space for the hosting package",
|
||||
verbose_name="disk space",
|
||||
),
|
||||
),
|
||||
(
|
||||
"diskspace_unit",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="unit of disk space",
|
||||
choices=[(0, "MiB"), (1, "GiB"), (2, "TiB")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Hosting package',
|
||||
'verbose_name_plural': 'Hosting packages',
|
||||
"verbose_name": "Hosting package",
|
||||
"verbose_name_plural": "Hosting packages",
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MailboxOption',
|
||||
name="MailboxOption",
|
||||
fields=[
|
||||
('hostingoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
unique=True, verbose_name='number of mailboxes')),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
unique=True, verbose_name="number of mailboxes"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Mailbox option',
|
||||
'verbose_name_plural': 'Mailbox options',
|
||||
"ordering": ["number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Mailbox option",
|
||||
"verbose_name_plural": "Mailbox options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='UserDatabaseOption',
|
||||
name="UserDatabaseOption",
|
||||
fields=[
|
||||
('hostingoption_ptr',
|
||||
models.OneToOneField(
|
||||
parent_link=True, auto_created=True, primary_key=True,
|
||||
serialize=False, to='hostingpackages.HostingOption',
|
||||
on_delete=models.CASCADE)),
|
||||
('number', models.PositiveIntegerField(
|
||||
default=1, verbose_name='number of databases')),
|
||||
('db_type',
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name='database type',
|
||||
choices=[(0, 'PostgreSQL'), (1, 'MySQL')])),
|
||||
(
|
||||
"hostingoption_ptr",
|
||||
models.OneToOneField(
|
||||
parent_link=True,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
to="hostingpackages.HostingOption",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"number",
|
||||
models.PositiveIntegerField(
|
||||
default=1, verbose_name="number of databases"
|
||||
),
|
||||
),
|
||||
(
|
||||
"db_type",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="database type",
|
||||
choices=[(0, "PostgreSQL"), (1, "MySQL")],
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'ordering': ['db_type', 'number'],
|
||||
'abstract': False,
|
||||
'verbose_name': 'Database option',
|
||||
'verbose_name_plural': 'Database options',
|
||||
"ordering": ["db_type", "number"],
|
||||
"abstract": False,
|
||||
"verbose_name": "Database option",
|
||||
"verbose_name_plural": "Database options",
|
||||
},
|
||||
bases=('hostingpackages.hostingoption', models.Model),
|
||||
bases=("hostingpackages.hostingoption", models.Model),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='userdatabaseoption',
|
||||
unique_together={('number', 'db_type')},
|
||||
name="userdatabaseoption",
|
||||
unique_together={("number", "db_type")},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='diskspaceoption',
|
||||
unique_together={('diskspace', 'diskspace_unit')},
|
||||
name="diskspaceoption",
|
||||
unique_together={("diskspace", "diskspace_unit")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customeruserdatabaseoption',
|
||||
name='template',
|
||||
model_name="customeruserdatabaseoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='user database option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The user database option template that this '
|
||||
'hosting option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="user database option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The user database option template that this "
|
||||
"hosting option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customeruserdatabaseoption',
|
||||
unique_together={('number', 'db_type')},
|
||||
name="customeruserdatabaseoption",
|
||||
unique_together={("number", "db_type")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customermailboxoption',
|
||||
name='template',
|
||||
model_name="customermailboxoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='mailbox option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The mailbox option template that this mailbox '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="mailbox option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The mailbox option template that this mailbox "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackageoption',
|
||||
name='hosting_package',
|
||||
model_name="customerhostingpackageoption",
|
||||
name="hosting_package",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='hosting package',
|
||||
to='hostingpackages.CustomerHostingPackage',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="hosting package",
|
||||
to="hostingpackages.CustomerHostingPackage",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackage',
|
||||
name='template',
|
||||
model_name="customerhostingpackage",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='hosting package template',
|
||||
to='hostingpackages.HostingPackageTemplate',
|
||||
help_text='The hosting package template that this hosting '
|
||||
'package is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="hosting package template",
|
||||
to="hostingpackages.HostingPackageTemplate",
|
||||
help_text="The hosting package template that this hosting "
|
||||
"package is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerdiskspaceoption',
|
||||
name='template',
|
||||
model_name="customerdiskspaceoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='disk space option template',
|
||||
to='hostingpackages.DiskSpaceOption',
|
||||
help_text='The disk space option template that this hosting '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="disk space option template",
|
||||
to="hostingpackages.DiskSpaceOption",
|
||||
help_text="The disk space option template that this hosting "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customerdiskspaceoption',
|
||||
unique_together={('diskspace', 'diskspace_unit')},
|
||||
name="customerdiskspaceoption",
|
||||
unique_together={("diskspace", "diskspace_unit")},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customerdiskspaceoption',
|
||||
name='template',
|
||||
model_name="customerdiskspaceoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='disk space option template',
|
||||
to='hostingpackages.DiskSpaceOption',
|
||||
help_text='The disk space option template that this disk '
|
||||
'space option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="disk space option template",
|
||||
to="hostingpackages.DiskSpaceOption",
|
||||
help_text="The disk space option template that this disk "
|
||||
"space option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customeruserdatabaseoption',
|
||||
name='template',
|
||||
model_name="customeruserdatabaseoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='user database option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The user database option template that this '
|
||||
'database option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="user database option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The user database option template that this "
|
||||
"database option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customerhostingpackage',
|
||||
name='name',
|
||||
field=models.CharField(max_length=128, verbose_name='name'),
|
||||
model_name="customerhostingpackage",
|
||||
name="name",
|
||||
field=models.CharField(max_length=128, verbose_name="name"),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customerhostingpackage',
|
||||
unique_together={('customer', 'name')},
|
||||
name="customerhostingpackage",
|
||||
unique_together={("customer", "name")},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackage',
|
||||
name='osuser',
|
||||
model_name="customerhostingpackage",
|
||||
name="osuser",
|
||||
field=models.OneToOneField(
|
||||
null=True, blank=True, to='osusers.User',
|
||||
verbose_name='Operating system user', on_delete=models.CASCADE),
|
||||
null=True,
|
||||
blank=True,
|
||||
to="osusers.User",
|
||||
verbose_name="Operating system user",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,57 +1,59 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('hostingpackages', '0001_initial'),
|
||||
("hostingpackages", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customerdiskspaceoption',
|
||||
name='template',
|
||||
model_name="customerdiskspaceoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='disk space option template',
|
||||
to='hostingpackages.DiskSpaceOption',
|
||||
help_text='The disk space option template that this disk '
|
||||
'space option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="disk space option template",
|
||||
to="hostingpackages.DiskSpaceOption",
|
||||
help_text="The disk space option template that this disk "
|
||||
"space option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customerhostingpackage',
|
||||
name='template',
|
||||
model_name="customerhostingpackage",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='hosting package template',
|
||||
to='hostingpackages.HostingPackageTemplate',
|
||||
help_text='The hosting package template that this hosting '
|
||||
'package is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="hosting package template",
|
||||
to="hostingpackages.HostingPackageTemplate",
|
||||
help_text="The hosting package template that this hosting "
|
||||
"package is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customermailboxoption',
|
||||
name='template',
|
||||
model_name="customermailboxoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='mailbox option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The mailbox option template that this mailbox '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="mailbox option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The mailbox option template that this mailbox "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customeruserdatabaseoption',
|
||||
name='template',
|
||||
model_name="customeruserdatabaseoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='user database option template',
|
||||
to='hostingpackages.UserDatabaseOption',
|
||||
help_text='The user database option template that this '
|
||||
'database option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="user database option template",
|
||||
to="hostingpackages.UserDatabaseOption",
|
||||
help_text="The user database option template that this "
|
||||
"database option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hostingpackages', '0001_squashed_0005_auto_20150118_1303'),
|
||||
("hostingpackages", "0001_squashed_0005_auto_20150118_1303"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='hostingoption',
|
||||
name="hostingoption",
|
||||
options={},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hostingpackages', '0002_auto_20150118_1149'),
|
||||
("hostingpackages", "0002_auto_20150118_1149"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customerhostingpackage',
|
||||
name='name',
|
||||
field=models.CharField(max_length=128, verbose_name='name'),
|
||||
model_name="customerhostingpackage",
|
||||
name="name",
|
||||
field=models.CharField(max_length=128, verbose_name="name"),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customerhostingpackage',
|
||||
unique_together=set([('customer', 'name')]),
|
||||
name="customerhostingpackage",
|
||||
unique_together=set([("customer", "name")]),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('hostingpackages', '0002_auto_20150118_1319'),
|
||||
("hostingpackages", "0002_auto_20150118_1319"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customermailboxoption',
|
||||
name='template',
|
||||
model_name="customermailboxoption",
|
||||
name="template",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='mailbox option template',
|
||||
to='hostingpackages.MailboxOption',
|
||||
help_text='The mailbox option template that this mailbox '
|
||||
'option is based on',
|
||||
on_delete=models.CASCADE),
|
||||
verbose_name="mailbox option template",
|
||||
to="hostingpackages.MailboxOption",
|
||||
help_text="The mailbox option template that this mailbox "
|
||||
"option is based on",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('osusers', '0004_auto_20150104_1751'),
|
||||
('hostingpackages', '0003_auto_20150118_1221'),
|
||||
("osusers", "0004_auto_20150104_1751"),
|
||||
("hostingpackages", "0003_auto_20150118_1221"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='customerhostingpackage',
|
||||
name='osuser',
|
||||
model_name="customerhostingpackage",
|
||||
name="osuser",
|
||||
field=models.ForeignKey(
|
||||
verbose_name='Operating system user', blank=True,
|
||||
to='osusers.User', null=True, on_delete=models.CASCADE),
|
||||
verbose_name="Operating system user",
|
||||
blank=True,
|
||||
to="osusers.User",
|
||||
null=True,
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.utils.timezone
|
||||
import model_utils.fields
|
||||
from django.db import migrations, models
|
||||
|
@ -8,33 +6,59 @@ from django.db import migrations, models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('domains', '0002_auto_20150124_1909'),
|
||||
('hostingpackages', '0003_auto_20150118_1407'),
|
||||
("domains", "0002_auto_20150124_1909"),
|
||||
("hostingpackages", "0003_auto_20150118_1407"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CustomerHostingPackageDomain',
|
||||
name="CustomerHostingPackageDomain",
|
||||
fields=[
|
||||
('id', models.AutoField(
|
||||
verbose_name='ID', serialize=False, auto_created=True,
|
||||
primary_key=True)),
|
||||
('created', model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now, verbose_name='created',
|
||||
editable=False)),
|
||||
('modified', model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now, verbose_name='modified',
|
||||
editable=False)),
|
||||
('domain', models.OneToOneField(
|
||||
verbose_name='hosting domain', to='domains.HostingDomain',
|
||||
on_delete=models.CASCADE)),
|
||||
('hosting_package', models.ForeignKey(
|
||||
related_name='domains', verbose_name='hosting package',
|
||||
to='hostingpackages.CustomerHostingPackage',
|
||||
on_delete=models.CASCADE)),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"created",
|
||||
model_utils.fields.AutoCreatedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="created",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified",
|
||||
model_utils.fields.AutoLastModifiedField(
|
||||
default=django.utils.timezone.now,
|
||||
verbose_name="modified",
|
||||
editable=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"domain",
|
||||
models.OneToOneField(
|
||||
verbose_name="hosting domain",
|
||||
to="domains.HostingDomain",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
(
|
||||
"hosting_package",
|
||||
models.ForeignKey(
|
||||
related_name="domains",
|
||||
verbose_name="hosting package",
|
||||
to="hostingpackages.CustomerHostingPackage",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
"abstract": False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('hostingpackages', '0004_customerhostingpackage_osuser'),
|
||||
("hostingpackages", "0004_customerhostingpackage_osuser"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customerhostingpackage',
|
||||
name='osuser',
|
||||
model_name="customerhostingpackage",
|
||||
name="osuser",
|
||||
field=models.OneToOneField(
|
||||
null=True, blank=True, to='osusers.User',
|
||||
verbose_name='Operating system user', on_delete=models.CASCADE),
|
||||
null=True,
|
||||
blank=True,
|
||||
to="osusers.User",
|
||||
verbose_name="Operating system user",
|
||||
on_delete=models.CASCADE,
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hostingpackages', '0004_customerhostingpackagedomain'),
|
||||
("hostingpackages", "0004_customerhostingpackagedomain"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='diskspaceoption',
|
||||
name="diskspaceoption",
|
||||
options={},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customerdiskspaceoption',
|
||||
name="customerdiskspaceoption",
|
||||
unique_together=set([]),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hostingpackages', '0005_auto_20150125_1508'),
|
||||
("hostingpackages", "0005_auto_20150125_1508"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='userdatabaseoption',
|
||||
name="userdatabaseoption",
|
||||
options={},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customeruserdatabaseoption',
|
||||
name="customeruserdatabaseoption",
|
||||
unique_together=set([]),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -2,21 +2,20 @@
|
|||
This module contains the hosting package models.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db import models
|
||||
from django.db import models, transaction
|
||||
from django.urls import reverse
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import ngettext
|
||||
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, Group, User as OsUser
|
||||
from osusers.models import AdditionalGroup, Group
|
||||
from osusers.models import User as OsUser
|
||||
from userdbs.models import DB_TYPES, UserDatabase
|
||||
|
||||
DISK_SPACE_UNITS = Choices((0, "M", _("MiB")), (1, "G", _("GiB")), (2, "T", _("TiB")))
|
||||
|
@ -24,7 +23,6 @@ DISK_SPACE_UNITS = Choices((0, "M", _("MiB")), (1, "G", _("GiB")), (2, "T", _("T
|
|||
DISK_SPACE_FACTORS = ((1, None, None), (1024, 1, None), (1024 * 1024, 1024, 1))
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class HostingPackageBase(TimeStampedModel):
|
||||
description = models.TextField(_("description"), blank=True)
|
||||
mailboxcount = models.PositiveIntegerField(_("mailbox count"))
|
||||
|
@ -57,7 +55,6 @@ class HostingOption(TimeStampedModel):
|
|||
"""
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class DiskSpaceOptionBase(models.Model):
|
||||
diskspace = models.PositiveIntegerField(_("disk space"))
|
||||
diskspace_unit = models.PositiveSmallIntegerField(
|
||||
|
@ -87,7 +84,6 @@ class DiskSpaceOption(DiskSpaceOptionBase, HostingOption):
|
|||
unique_together = ["diskspace", "diskspace_unit"]
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class UserDatabaseOptionBase(models.Model):
|
||||
number = models.PositiveIntegerField(_("number of databases"), default=1)
|
||||
db_type = models.PositiveSmallIntegerField(_("database type"), choices=DB_TYPES)
|
||||
|
@ -99,7 +95,7 @@ class UserDatabaseOptionBase(models.Model):
|
|||
verbose_name_plural = _("Database options")
|
||||
|
||||
def __str__(self):
|
||||
return ungettext(
|
||||
return ngettext(
|
||||
"{type} database", "{count} {type} databases", self.number
|
||||
).format(type=self.get_db_type_display(), count=self.number)
|
||||
|
||||
|
@ -115,7 +111,6 @@ class UserDatabaseOption(UserDatabaseOptionBase, HostingOption):
|
|||
unique_together = ["number", "db_type"]
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class MailboxOptionBase(models.Model):
|
||||
"""
|
||||
Base class for mailbox options.
|
||||
|
@ -131,7 +126,7 @@ class MailboxOptionBase(models.Model):
|
|||
verbose_name_plural = _("Mailbox options")
|
||||
|
||||
def __str__(self):
|
||||
return ungettext(
|
||||
return ngettext(
|
||||
"{count} additional mailbox", "{count} additional mailboxes", self.number
|
||||
).format(count=self.number)
|
||||
|
||||
|
@ -177,7 +172,6 @@ class CustomerHostingPackageManager(models.Manager):
|
|||
return package
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CustomerHostingPackage(HostingPackageBase):
|
||||
"""
|
||||
This class defines customer specific hosting packages.
|
||||
|
@ -269,7 +263,7 @@ class CustomerHostingPackage(HostingPackageBase):
|
|||
) + option.diskspace
|
||||
min_unit = option.diskspace_unit
|
||||
if unit is None:
|
||||
return DISK_SPACE_FACTORS[min_unit][0] * diskspace * 1024 ** 2
|
||||
return DISK_SPACE_FACTORS[min_unit][0] * diskspace * 1024**2
|
||||
if unit > min_unit:
|
||||
return DISK_SPACE_FACTORS[unit][min_unit] * diskspace
|
||||
return DISK_SPACE_FACTORS[min_unit][unit] * diskspace
|
||||
|
@ -287,7 +281,7 @@ class CustomerHostingPackage(HostingPackageBase):
|
|||
"""
|
||||
if unit is None:
|
||||
return (
|
||||
DISK_SPACE_FACTORS[self.diskspace_unit][0] * self.diskspace * 1024 ** 2
|
||||
DISK_SPACE_FACTORS[self.diskspace_unit][0] * self.diskspace * 1024**2
|
||||
)
|
||||
if unit > self.diskspace_unit:
|
||||
return DISK_SPACE_FACTORS[unit][self.diskspace_unit] * self.diskspace
|
||||
|
@ -382,7 +376,6 @@ 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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
This module defines the URL patterns for hosting package related views.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import (
|
||||
AddHostingOption,
|
||||
|
@ -16,22 +16,36 @@ from .views import (
|
|||
HostingOptionChoices,
|
||||
)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^create$', CreateHostingPackage.as_view(),
|
||||
name='create_hosting_package'),
|
||||
url(r'^allpackages/',
|
||||
AllCustomerHostingPackageList.as_view(), name='all_hosting_packages'),
|
||||
url(r'^(?P<user>[-\w0-9@.+_]+)/$',
|
||||
CustomerHostingPackageList.as_view(), name='hosting_packages'),
|
||||
url(r'^(?P<user>[-\w0-9@.+_]+)/create$',
|
||||
re_path(r"^create$", CreateHostingPackage.as_view(), name="create_hosting_package"),
|
||||
re_path(
|
||||
r"^allpackages/",
|
||||
AllCustomerHostingPackageList.as_view(),
|
||||
name="all_hosting_packages",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<user>[-\w0-9@.+_]+)/$",
|
||||
CustomerHostingPackageList.as_view(),
|
||||
name="hosting_packages",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<user>[-\w0-9@.+_]+)/create$",
|
||||
CreateCustomerHostingPackage.as_view(),
|
||||
name='create_customer_hosting_package'),
|
||||
url(r'^(?P<user>[-\w0-9@.+_]+)/(?P<pk>\d+)/$',
|
||||
name="create_customer_hosting_package",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<user>[-\w0-9@.+_]+)/(?P<pk>\d+)/$",
|
||||
CustomerHostingPackageDetails.as_view(),
|
||||
name='hosting_package_details'),
|
||||
url(r'^(?P<pk>\d+)/option-choices$',
|
||||
HostingOptionChoices.as_view(), name='hosting_option_choices'),
|
||||
url(r'^(?P<package>\d+)/add-option/(?P<type>\w+)/(?P<optionid>\d+)$',
|
||||
AddHostingOption.as_view(), name='add_hosting_option'),
|
||||
name="hosting_package_details",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<pk>\d+)/option-choices$",
|
||||
HostingOptionChoices.as_view(),
|
||||
name="hosting_option_choices",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<package>\d+)/add-option/(?P<type>\w+)/(?P<optionid>\d+)$",
|
||||
AddHostingOption.as_view(),
|
||||
name="add_hosting_option",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -2,28 +2,17 @@
|
|||
This module defines views related to hosting packages.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from braces.views import LoginRequiredMixin, StaffuserRequiredMixin
|
||||
from django.conf import settings
|
||||
from django.http import Http404
|
||||
from django.shortcuts import redirect, get_object_or_404
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic import (
|
||||
DetailView,
|
||||
ListView,
|
||||
)
|
||||
from django.views.generic.edit import (
|
||||
CreateView,
|
||||
FormView,
|
||||
)
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from braces.views import (
|
||||
LoginRequiredMixin,
|
||||
StaffuserRequiredMixin,
|
||||
)
|
||||
|
||||
from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import DetailView, ListView
|
||||
from django.views.generic.edit import CreateView, FormView
|
||||
from gvacommon.viewmixins import StaffOrSelfLoginRequiredMixin
|
||||
|
||||
from .forms import (
|
||||
|
@ -41,24 +30,24 @@ from .models import (
|
|||
)
|
||||
|
||||
|
||||
class CreateHostingPackage(
|
||||
LoginRequiredMixin, StaffuserRequiredMixin, CreateView
|
||||
):
|
||||
class CreateHostingPackage(LoginRequiredMixin, StaffuserRequiredMixin, CreateView):
|
||||
"""
|
||||
Create a hosting package.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackage
|
||||
raise_exception = True
|
||||
template_name_suffix = '_create'
|
||||
template_name_suffix = "_create"
|
||||
form_class = CreateHostingPackageForm
|
||||
|
||||
def form_valid(self, form):
|
||||
hostingpackage = form.save()
|
||||
messages.success(
|
||||
self.request,
|
||||
_('Started setup of new hosting package {name}.').format(
|
||||
name=hostingpackage.name)
|
||||
_("Started setup of new hosting package {name}.").format(
|
||||
name=hostingpackage.name
|
||||
),
|
||||
)
|
||||
return redirect(hostingpackage)
|
||||
|
||||
|
@ -68,6 +57,7 @@ class CreateCustomerHostingPackage(CreateHostingPackage):
|
|||
Create a hosting package for a selected customer.
|
||||
|
||||
"""
|
||||
|
||||
form_class = CreateCustomerHostingPackageForm
|
||||
|
||||
def get_form_kwargs(self):
|
||||
|
@ -76,13 +66,11 @@ class CreateCustomerHostingPackage(CreateHostingPackage):
|
|||
return kwargs
|
||||
|
||||
def get_customer_object(self):
|
||||
return get_object_or_404(
|
||||
get_user_model(), username=self.kwargs['user'])
|
||||
return get_object_or_404(get_user_model(), username=self.kwargs["user"])
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(
|
||||
CreateCustomerHostingPackage, self).get_context_data(**kwargs)
|
||||
context['customer'] = self.get_customer_object()
|
||||
context = super(CreateCustomerHostingPackage, self).get_context_data(**kwargs)
|
||||
context["customer"] = self.get_customer_object()
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
|
@ -91,8 +79,9 @@ class CreateCustomerHostingPackage(CreateHostingPackage):
|
|||
hostingpackage.save()
|
||||
messages.success(
|
||||
self.request,
|
||||
_('Started setup of new hosting package {name}.').format(
|
||||
name=hostingpackage.name)
|
||||
_("Started setup of new hosting package {name}.").format(
|
||||
name=hostingpackage.name
|
||||
),
|
||||
)
|
||||
return redirect(hostingpackage)
|
||||
|
||||
|
@ -102,30 +91,32 @@ class CustomerHostingPackageDetails(StaffOrSelfLoginRequiredMixin, DetailView):
|
|||
This view is for showing details of a customer hosting package.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackage
|
||||
context_object_name = 'hostingpackage'
|
||||
context_object_name = "hostingpackage"
|
||||
customer = None
|
||||
|
||||
def get_customer_object(self):
|
||||
if self.customer is None:
|
||||
self.customer = get_object_or_404(
|
||||
get_user_model(), username=self.kwargs['user'])
|
||||
get_user_model(), username=self.kwargs["user"]
|
||||
)
|
||||
return self.customer
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CustomerHostingPackageDetails, self).get_context_data(
|
||||
**kwargs)
|
||||
context.update({
|
||||
'customer': self.get_customer_object(),
|
||||
'uploadserver': settings.OSUSER_UPLOAD_SERVER,
|
||||
'databases': context['hostingpackage'].databases,
|
||||
'osuser': context['hostingpackage'].osuser,
|
||||
'hostingoptions':
|
||||
context['hostingpackage'].get_hostingoptions(),
|
||||
'domains': context['hostingpackage'].domains.all(),
|
||||
'mailboxes': context['hostingpackage'].mailboxes,
|
||||
})
|
||||
context['sshkeys'] = context['osuser'].sshpublickey_set.all()
|
||||
context = super(CustomerHostingPackageDetails, self).get_context_data(**kwargs)
|
||||
context.update(
|
||||
{
|
||||
"customer": self.get_customer_object(),
|
||||
"uploadserver": settings.OSUSER_UPLOAD_SERVER,
|
||||
"databases": context["hostingpackage"].databases,
|
||||
"osuser": context["hostingpackage"].osuser,
|
||||
"hostingoptions": context["hostingpackage"].get_hostingoptions(),
|
||||
"domains": context["hostingpackage"].domains.all(),
|
||||
"mailboxes": context["hostingpackage"].mailboxes,
|
||||
}
|
||||
)
|
||||
context["sshkeys"] = context["osuser"].sshpublickey_set.all()
|
||||
return context
|
||||
|
||||
|
||||
|
@ -136,8 +127,9 @@ class AllCustomerHostingPackageList(
|
|||
This view is used for showing a list of all hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackage
|
||||
template_name_suffix = '_admin_list'
|
||||
template_name_suffix = "_admin_list"
|
||||
|
||||
|
||||
class CustomerHostingPackageList(StaffOrSelfLoginRequiredMixin, ListView):
|
||||
|
@ -145,113 +137,128 @@ class CustomerHostingPackageList(StaffOrSelfLoginRequiredMixin, ListView):
|
|||
This view is used for showing a list of a customer's hosting packages.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackage
|
||||
customer = None
|
||||
|
||||
def get_customer_object(self):
|
||||
if self.customer is None:
|
||||
self.customer = get_object_or_404(
|
||||
get_user_model(), username=self.kwargs['user'])
|
||||
get_user_model(), username=self.kwargs["user"]
|
||||
)
|
||||
return self.customer
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CustomerHostingPackageList, self).get_context_data(
|
||||
**kwargs)
|
||||
context['customer'] = self.get_customer_object()
|
||||
context = super(CustomerHostingPackageList, self).get_context_data(**kwargs)
|
||||
context["customer"] = self.get_customer_object()
|
||||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
return super(CustomerHostingPackageList, self).get_queryset().filter(
|
||||
customer__username=self.kwargs['user'])
|
||||
return (
|
||||
super(CustomerHostingPackageList, self)
|
||||
.get_queryset()
|
||||
.filter(customer__username=self.kwargs["user"])
|
||||
)
|
||||
|
||||
|
||||
class HostingOptionChoices(
|
||||
LoginRequiredMixin, StaffuserRequiredMixin, DetailView
|
||||
):
|
||||
class HostingOptionChoices(LoginRequiredMixin, StaffuserRequiredMixin, DetailView):
|
||||
"""
|
||||
This view displays choices of hosting options for a customer hosting
|
||||
package.
|
||||
|
||||
"""
|
||||
|
||||
model = CustomerHostingPackage
|
||||
context_object_name = 'hostingpackage'
|
||||
template_name_suffix = '_option_choices'
|
||||
context_object_name = "hostingpackage"
|
||||
template_name_suffix = "_option_choices"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(HostingOptionChoices, self).get_context_data(
|
||||
**kwargs)
|
||||
context.update({
|
||||
'customer': self.get_object().customer,
|
||||
'hosting_options': (
|
||||
(_('Disk space'),
|
||||
[(option, 'diskspace') for option in
|
||||
DiskSpaceOption.objects.all()]),
|
||||
(_('Mailboxes'),
|
||||
[(option, 'mailboxes') for option in
|
||||
MailboxOption.objects.all()]),
|
||||
(_('Databases'),
|
||||
[(option, 'databases') for option in
|
||||
UserDatabaseOption.objects.all()]),
|
||||
),
|
||||
})
|
||||
context = super(HostingOptionChoices, self).get_context_data(**kwargs)
|
||||
context.update(
|
||||
{
|
||||
"customer": self.get_object().customer,
|
||||
"hosting_options": (
|
||||
(
|
||||
_("Disk space"),
|
||||
[
|
||||
(option, "diskspace")
|
||||
for option in DiskSpaceOption.objects.all()
|
||||
],
|
||||
),
|
||||
(
|
||||
_("Mailboxes"),
|
||||
[
|
||||
(option, "mailboxes")
|
||||
for option in MailboxOption.objects.all()
|
||||
],
|
||||
),
|
||||
(
|
||||
_("Databases"),
|
||||
[
|
||||
(option, "databases")
|
||||
for option in UserDatabaseOption.objects.all()
|
||||
],
|
||||
),
|
||||
),
|
||||
}
|
||||
)
|
||||
return context
|
||||
|
||||
|
||||
class AddHostingOption(
|
||||
LoginRequiredMixin, StaffuserRequiredMixin, FormView
|
||||
):
|
||||
template_name = 'hostingpackages/add_hosting_option.html'
|
||||
class AddHostingOption(LoginRequiredMixin, StaffuserRequiredMixin, FormView):
|
||||
template_name = "hostingpackages/add_hosting_option.html"
|
||||
|
||||
def get_form_class(self):
|
||||
optiontype = self.kwargs['type']
|
||||
if optiontype == 'diskspace':
|
||||
optiontype = self.kwargs["type"]
|
||||
if optiontype == "diskspace":
|
||||
return AddDiskspaceOptionForm
|
||||
elif optiontype == 'mailboxes':
|
||||
elif optiontype == "mailboxes":
|
||||
return AddMailboxOptionForm
|
||||
elif optiontype == 'databases':
|
||||
elif optiontype == "databases":
|
||||
return AddUserDatabaseOptionForm
|
||||
raise Http404()
|
||||
|
||||
def get_hosting_package(self):
|
||||
return get_object_or_404(
|
||||
CustomerHostingPackage, pk=int(self.kwargs['package']))
|
||||
return get_object_or_404(CustomerHostingPackage, pk=int(self.kwargs["package"]))
|
||||
|
||||
def get_option_template(self):
|
||||
optiontype = self.kwargs['type']
|
||||
optionid = int(self.kwargs['optionid'])
|
||||
if optiontype == 'diskspace':
|
||||
optiontype = self.kwargs["type"]
|
||||
optionid = int(self.kwargs["optionid"])
|
||||
if optiontype == "diskspace":
|
||||
return get_object_or_404(DiskSpaceOption, pk=optionid)
|
||||
elif optiontype == 'mailboxes':
|
||||
elif optiontype == "mailboxes":
|
||||
return get_object_or_404(MailboxOption, pk=optionid)
|
||||
elif optiontype == 'databases':
|
||||
elif optiontype == "databases":
|
||||
return get_object_or_404(UserDatabaseOption, pk=optionid)
|
||||
raise Http404()
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(AddHostingOption, self).get_form_kwargs()
|
||||
kwargs['hostingpackage'] = self.get_hosting_package()
|
||||
kwargs['option_template'] = self.get_option_template()
|
||||
kwargs["hostingpackage"] = self.get_hosting_package()
|
||||
kwargs["option_template"] = self.get_option_template()
|
||||
return kwargs
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(AddHostingOption, self).get_initial()
|
||||
template = self.get_option_template()
|
||||
if type(template) == DiskSpaceOption:
|
||||
initial.update({
|
||||
'diskspace': template.diskspace,
|
||||
'diskspace_unit': template.diskspace_unit,
|
||||
})
|
||||
initial.update(
|
||||
{
|
||||
"diskspace": template.diskspace,
|
||||
"diskspace_unit": template.diskspace_unit,
|
||||
}
|
||||
)
|
||||
elif type(template) == MailboxOption:
|
||||
initial['number'] = template.number
|
||||
initial["number"] = template.number
|
||||
elif type(template) == UserDatabaseOption:
|
||||
initial['number'] = template.number
|
||||
initial["number"] = template.number
|
||||
else:
|
||||
raise Http404()
|
||||
return initial
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AddHostingOption, self).get_context_data(**kwargs)
|
||||
context['option_template'] = self.get_option_template()
|
||||
context["option_template"] = self.get_option_template()
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
|
@ -259,8 +266,8 @@ class AddHostingOption(
|
|||
hosting_package = self.get_hosting_package()
|
||||
messages.success(
|
||||
self.request,
|
||||
_("Successfully added option {option} to hosting package "
|
||||
"{package}.").format(
|
||||
option=option, package=hosting_package.name)
|
||||
_(
|
||||
"Successfully added option {option} to hosting package " "{package}."
|
||||
).format(option=option, package=hosting_package.name),
|
||||
)
|
||||
return redirect(hosting_package)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue