implement adding websites
- implement websites.models.Website - add migration - implement websites.views.AddWebsite - implement websites.forms.AddWebsiteForm - define URL pattern 'add_website' in websites.urls - register Website model in websites.admin - add templates websites/base.html and websites/website_create.html - add german translation for new strings - add website URLs to gnuviechadmin.urls - add websites to INSTALLED_APPS - add changelog entry
This commit is contained in:
parent
cff35dd408
commit
711a96212c
12 changed files with 297 additions and 5 deletions
|
@ -1,3 +1,37 @@
|
|||
from django.db import models
|
||||
"""
|
||||
This module defines the database models for website handling.
|
||||
|
||||
# Create your models here.
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from domains.models import HostingDomain
|
||||
from osusers.models import User as OsUser
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Website(models.Model):
|
||||
"""
|
||||
This is the model for a website.
|
||||
|
||||
"""
|
||||
subdomain = models.CharField(
|
||||
_('sub domain'), max_length=64)
|
||||
osuser = models.ForeignKey(
|
||||
OsUser, verbose_name=_('operating system user'))
|
||||
domain = models.ForeignKey(
|
||||
HostingDomain, verbose_name=_('domain'))
|
||||
wildcard = models.BooleanField(_('wildcard'), default=False)
|
||||
|
||||
class Meta:
|
||||
unique_together = [('domain', 'subdomain')]
|
||||
verbose_name = _('website')
|
||||
verbose_name_plural = _('websites')
|
||||
|
||||
def __str__(self):
|
||||
return "{subdomain}.{domain}".format(
|
||||
subdomain=self.subdomain, domain=self.domain.domain
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue