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,19 +2,17 @@
|
|||
This module defines the database models for website handling.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.db import models, transaction
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from domains.models import HostingDomain
|
||||
from osusers.models import User as OsUser
|
||||
|
||||
from fileservertasks.tasks import (
|
||||
create_file_website_hierarchy,
|
||||
delete_file_website_hierarchy,
|
||||
)
|
||||
from osusers.models import User as OsUser
|
||||
from webtasks.tasks import (
|
||||
create_web_php_fpm_pool_config,
|
||||
create_web_vhost_config,
|
||||
|
@ -25,25 +23,23 @@ from webtasks.tasks import (
|
|||
)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Website(models.Model):
|
||||
"""
|
||||
This is the model for a website.
|
||||
|
||||
"""
|
||||
subdomain = models.CharField(
|
||||
_('sub domain'), max_length=64)
|
||||
|
||||
subdomain = models.CharField(_("sub domain"), max_length=64)
|
||||
osuser = models.ForeignKey(
|
||||
OsUser, verbose_name=_('operating system user'),
|
||||
on_delete=models.CASCADE)
|
||||
domain = models.ForeignKey(
|
||||
HostingDomain, models.CASCADE, verbose_name=_('domain'))
|
||||
wildcard = models.BooleanField(_('wildcard'), default=False)
|
||||
OsUser, verbose_name=_("operating system user"), on_delete=models.CASCADE
|
||||
)
|
||||
domain = models.ForeignKey(HostingDomain, models.CASCADE, verbose_name=_("domain"))
|
||||
wildcard = models.BooleanField(_("wildcard"), default=False)
|
||||
|
||||
class Meta:
|
||||
unique_together = [('domain', 'subdomain')]
|
||||
verbose_name = _('website')
|
||||
verbose_name_plural = _('websites')
|
||||
unique_together = [("domain", "subdomain")]
|
||||
verbose_name = _("website")
|
||||
verbose_name_plural = _("websites")
|
||||
|
||||
def __str__(self):
|
||||
return self.get_fqdn()
|
||||
|
@ -58,12 +54,11 @@ class Website(models.Model):
|
|||
if not self.pk:
|
||||
fqdn = self.get_fqdn()
|
||||
if not Website.objects.filter(osuser=self.osuser).exists():
|
||||
create_web_php_fpm_pool_config.delay(
|
||||
self.osuser.username).get()
|
||||
create_file_website_hierarchy.delay(
|
||||
self.osuser.username, fqdn).get()
|
||||
create_web_php_fpm_pool_config.delay(self.osuser.username).get()
|
||||
create_file_website_hierarchy.delay(self.osuser.username, fqdn).get()
|
||||
create_web_vhost_config.delay(
|
||||
self.osuser.username, fqdn, self.wildcard).get()
|
||||
self.osuser.username, fqdn, self.wildcard
|
||||
).get()
|
||||
enable_web_vhost.delay(fqdn).get()
|
||||
return super(Website, self).save(*args, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue