Started port to Django 2.1, Python 3, Docker
This commit is a rough port to Django 2.1, Python 3 and a Docker based local development setup. Tests fail/error but migrations and the web frontend are already runnable. Task queue functionality is untested and translations seem to have trouble.
This commit is contained in:
		
							parent
							
								
									adc57657dd
								
							
						
					
					
						commit
						6cebd80c89
					
				
					 48 changed files with 1081 additions and 576 deletions
				
			
		
							
								
								
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -48,3 +48,5 @@ _build/ | |||
| gnuviechadmin/assets/ | ||||
| coverage-report/ | ||||
| .idea/ | ||||
| 
 | ||||
| .env | ||||
							
								
								
									
										31
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| FROM debian:stretch | ||||
| LABEL maintainer "Jan Dittberner <jan@dittberner.info>" | ||||
| 
 | ||||
| RUN apt-get update \ | ||||
|     && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||||
|     dumb-init \ | ||||
|     gettext \ | ||||
|     git \ | ||||
|     libpq-dev \ | ||||
|     python3-dev \ | ||||
|     python3-pip \ | ||||
|     && apt-get clean \ | ||||
|     && rm -rf /var/lib/apt/lists/*.* | ||||
| 
 | ||||
| VOLUME /srv/gnuviechadmin/media /srv/gnuviechadmin/static | ||||
| WORKDIR /srv/gnuviechadmin | ||||
| 
 | ||||
| ENV LC_ALL=C.UTF-8 | ||||
| ENV LANG=C.UTF-8 | ||||
| 
 | ||||
| RUN python3 -m pip install -U pip && pip3 install pipenv | ||||
| 
 | ||||
| COPY gnuviechadmin.sh /srv/ | ||||
| COPY Pipfile Pipfile.lock /srv/gnuviechadmin/ | ||||
| 
 | ||||
| RUN pipenv install --system --deploy --ignore-pipfile --dev | ||||
| 
 | ||||
| EXPOSE 8000 | ||||
| VOLUME /srv/gnuviechadmin | ||||
| 
 | ||||
| ENTRYPOINT ["dumb-init", "/srv/gnuviechadmin.sh"] | ||||
							
								
								
									
										4
									
								
								Pipfile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								Pipfile
									
										
									
									
									
								
							|  | @ -13,6 +13,8 @@ redis = "*" | |||
| gvacommon = {ref = "0.4.0", git = "https://git.dittberner.info/gnuviech/gvacommon.git"} | ||||
| requests-oauthlib = "*" | ||||
| django-allauth = "*" | ||||
| django-crispy-forms = "*" | ||||
| django-braces = "*" | ||||
| 
 | ||||
| [dev-packages] | ||||
| coverage = "*" | ||||
|  | @ -23,4 +25,4 @@ sphinxcontrib-blockdiag = "*" | |||
| pylama = "*" | ||||
| 
 | ||||
| [requires] | ||||
| python_version = "3.6" | ||||
| python_version = "3.5" | ||||
|  |  | |||
							
								
								
									
										20
									
								
								Pipfile.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										20
									
								
								Pipfile.lock
									
										
									
										generated
									
									
									
								
							|  | @ -1,11 +1,11 @@ | |||
| { | ||||
|     "_meta": { | ||||
|         "hash": { | ||||
|             "sha256": "ed0a23d288cc817ebfbf92a4acd140eee9e083d6331eaa5f06bdbc0d37c4767f" | ||||
|             "sha256": "3b941559bcaf1c164285aef53553496fbf1414f362da1433b705ac7c796e33e6" | ||||
|         }, | ||||
|         "pipfile-spec": 6, | ||||
|         "requires": { | ||||
|             "python_version": "3.6" | ||||
|             "python_version": "3.5" | ||||
|         }, | ||||
|         "sources": [ | ||||
|             { | ||||
|  | @ -73,6 +73,22 @@ | |||
|             "index": "pypi", | ||||
|             "version": "==0.38.0" | ||||
|         }, | ||||
|         "django-braces": { | ||||
|             "hashes": [ | ||||
|                 "sha256:a457d74ea29478123c0c4652272681b3cea0bf1232187fd9f9b6f1d97d32a890", | ||||
|                 "sha256:ba68e98b817c6f01d71d10849f359979617b3fe4cefb7f289adefddced092ddc" | ||||
|             ], | ||||
|             "index": "pypi", | ||||
|             "version": "==1.13.0" | ||||
|         }, | ||||
|         "django-crispy-forms": { | ||||
|             "hashes": [ | ||||
|                 "sha256:5952bab971110d0b86c278132dae0aa095beee8f723e625c3d3fa28888f1675f", | ||||
|                 "sha256:705ededc554ad8736157c666681165fe22ead2dec0d5446d65fc9dd976a5a876" | ||||
|             ], | ||||
|             "index": "pypi", | ||||
|             "version": "==1.7.2" | ||||
|         }, | ||||
|         "django-model-utils": { | ||||
|             "hashes": [ | ||||
|                 "sha256:2c057f3bf0859aba27f04389f0cedd2d48f8c9b3848acb86fd9970794e58f477", | ||||
|  |  | |||
							
								
								
									
										26
									
								
								Vagrantfile
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								Vagrantfile
									
										
									
									
										vendored
									
									
								
							|  | @ -1,26 +0,0 @@ | |||
| # -*- mode: ruby -*- | ||||
| # vi: set ft=ruby : | ||||
| 
 | ||||
| Vagrant.configure(2) do |config| | ||||
|   config.vm.box = "debian/stretch64" | ||||
| 
 | ||||
|   config.vm.hostname = "gva.local" | ||||
|   config.vm.network "private_network", ip: "172.16.3.2", lxc__bridge_name: 'vlxcbr1' | ||||
| 
 | ||||
|   config.vm.network "forwarded_port", guest: 443, host: 8443 | ||||
|   config.vm.network "forwarded_port", guest: 8000, host: 8000 | ||||
|   config.vm.network "forwarded_port", guest: 15672, host: 15672 | ||||
| 
 | ||||
|   config.vm.synced_folder "../gvasalt/states/", "/srv/salt/" | ||||
|   config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/" | ||||
| 
 | ||||
|   config.vm.provision :salt do |salt| | ||||
|       salt.bootstrap_script = "salt/bootstrap.sh" | ||||
|       salt.minion_id = "gva.local" | ||||
|       salt.masterless = true | ||||
|       salt.run_highstate = true | ||||
|       salt.verbose = true | ||||
|       salt.colorize = true | ||||
|       salt.log_level = "warning" | ||||
|   end | ||||
| end | ||||
							
								
								
									
										43
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| version: "3" | ||||
| services: | ||||
|   db: | ||||
|     image: gnuviech/pgsql:stretch | ||||
|     ports: | ||||
|       - "15432:5432" | ||||
|     env_file: .env | ||||
|     volumes: | ||||
|       - "pg_data:/var/lib/postgresql/9.6/main" | ||||
|   mq: | ||||
|     image: gnuviech/mq:stretch | ||||
|     env_file: .env | ||||
|     volumes: | ||||
|       - "mq_data:/var/lib/rabbitmq/mnesia" | ||||
|   redis: | ||||
|     image: gnuviech/redis:stretch | ||||
|     env_file: .env | ||||
|     volumes: | ||||
|       - "redis_data:/var/lib/redis" | ||||
|   gva: | ||||
|     build: | ||||
|       context: . | ||||
|     ports: | ||||
|       - "8000:8000" | ||||
|     depends_on: | ||||
|       - db | ||||
|       - mq | ||||
|       - redis | ||||
|     env_file: .env | ||||
|     environment: | ||||
|       DJANGO_SETTINGS_MODULE: gnuviechadmin.settings | ||||
|       GVA_DOMAIN_NAME: localhost | ||||
|       GVA_SITE_NAME: localhost | ||||
|     volumes: | ||||
|       - "django_media:/srv/gnuviechadmin/media" | ||||
|       - "django_static:/srv/gnuviechadmin/static" | ||||
|       - "./gnuviechadmin:/srv/gnuviechadmin" | ||||
| volumes: | ||||
|   django_media: | ||||
|   django_static: | ||||
|   pg_data: | ||||
|   redis_data: | ||||
|   mq_data: | ||||
							
								
								
									
										8
									
								
								gnuviechadmin.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								gnuviechadmin.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| python3 manage.py compilemessages | ||||
| python3 manage.py collectstatic --noinput | ||||
| python3 manage.py migrate --noinput | ||||
| python3 manage.py runserver 0.0.0.0:8000 | ||||
|  | @ -7,9 +7,9 @@ from __future__ import absolute_import, unicode_literals | |||
| from django import forms | ||||
| from django.conf import settings | ||||
| from django.core.mail import send_mail | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.template import RequestContext | ||||
| from django.template import loader | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | ||||
| from django.contrib.sites.models import Site | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ This module defines the views of the contact_form app. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django.shortcuts import redirect | ||||
| from django.core.urlresolvers import reverse_lazy | ||||
| from django.urls import reverse_lazy | ||||
| from django.views.generic import ( | ||||
|     FormView, | ||||
|     TemplateView, | ||||
|  | @ -31,7 +31,7 @@ class ContactFormView(FormView): | |||
|     def get_initial(self): | ||||
|         initial = super(ContactFormView, self).get_initial() | ||||
|         currentuser = self.request.user | ||||
|         if currentuser.is_authenticated(): | ||||
|         if currentuser.is_authenticated: | ||||
|             initial['name'] = ( | ||||
|                 currentuser.get_full_name() or currentuser.username) | ||||
|             initial['email'] = currentuser.email | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ from __future__ import absolute_import, unicode_literals | |||
| import re | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext as _ | ||||
| 
 | ||||
| from crispy_forms.helper import FormHelper | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ import model_utils.fields | |||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||||
|         ('domains', '0001_initial'), | ||||
|  | @ -18,12 +17,31 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='HostingDomain', | ||||
|             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.CharField(unique=True, max_length=128, verbose_name='domain name')), | ||||
|                 ('customer', models.ForeignKey(verbose_name='customer', blank=True, to=settings.AUTH_USER_MODEL, null=True)), | ||||
|                 ('maildomain', models.OneToOneField(null=True, to='domains.MailDomain', blank=True, help_text='assigned mail domain for this domain', verbose_name='mail domain')), | ||||
|                 ('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.CharField( | ||||
|                      unique=True, max_length=128, verbose_name='domain name')), | ||||
|                 ('customer', | ||||
|                  models.ForeignKey( | ||||
|                      verbose_name='customer', blank=True, | ||||
|                      to=settings.AUTH_USER_MODEL, null=True, | ||||
|                      on_delete=models.CASCADE)), | ||||
|                 ('maildomain', | ||||
|                  models.OneToOneField( | ||||
|                      null=True, to='domains.MailDomain', blank=True, | ||||
|                      help_text='assigned mail domain for this domain', | ||||
|                      verbose_name='mail domain', | ||||
|                      on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'Hosting domain', | ||||
|  | @ -34,13 +52,17 @@ class Migration(migrations.Migration): | |||
|         migrations.AddField( | ||||
|             model_name='maildomain', | ||||
|             name='customer', | ||||
|             field=models.ForeignKey(verbose_name='customer', blank=True, to=settings.AUTH_USER_MODEL, null=True), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='customer', blank=True, | ||||
|                 to=settings.AUTH_USER_MODEL, null=True, | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='maildomain', | ||||
|             name='domain', | ||||
|             field=models.CharField(unique=True, max_length=128, verbose_name='domain name'), | ||||
|             field=models.CharField( | ||||
|                 unique=True, max_length=128, verbose_name='domain name'), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ import model_utils.fields | |||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||||
|         ('domains', '0002_auto_20150124_1909'), | ||||
|  | @ -18,22 +17,29 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DNSComment', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('name', models.CharField(max_length=255)), | ||||
|                 ('commenttype', models.CharField(max_length=10, db_column='type')), | ||||
|                 ('commenttype', | ||||
|                  models.CharField(max_length=10, db_column='type')), | ||||
|                 ('modified_at', models.IntegerField()), | ||||
|                 ('comment', models.CharField(max_length=65535)), | ||||
|                 ('customer', models.ForeignKey(verbose_name='customer', to=settings.AUTH_USER_MODEL)), | ||||
|                 ('customer', models.ForeignKey( | ||||
|                     verbose_name='customer', | ||||
|                     to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), | ||||
|             ], | ||||
|         ), | ||||
|         migrations.RunSQL( | ||||
|             '''ALTER TABLE domains_dnscomment ADD CONSTRAINT c_lowercase_name | ||||
|             CHECK (((name)::TEXT = LOWER((name)::TEXT)))''' | ||||
|              CHECK (((name)::TEXT = LOWER((name)::TEXT)))''' | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='DNSCryptoKey', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('flags', models.IntegerField()), | ||||
|                 ('active', models.BooleanField(default=True)), | ||||
|                 ('content', models.TextField()), | ||||
|  | @ -42,15 +48,30 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DNSDomain', | ||||
|             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.CharField(unique=True, max_length=255, verbose_name='domain name')), | ||||
|                 ('master', models.CharField(max_length=128, null=True, blank=True)), | ||||
|                 ('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.CharField( | ||||
|                     unique=True, max_length=255, verbose_name='domain name')), | ||||
|                 ('master', | ||||
|                  models.CharField(max_length=128, null=True, blank=True)), | ||||
|                 ('last_check', models.IntegerField(null=True)), | ||||
|                 ('domaintype', models.CharField(max_length=6, db_column='type', choices=[('MASTER', 'Master'), ('SLAVE', 'Slave'), ('NATIVE', 'Native')])), | ||||
|                 ('domaintype', models.CharField( | ||||
|                     max_length=6, db_column='type', | ||||
|                     choices=[('MASTER', 'Master'), | ||||
|                              ('SLAVE', 'Slave'), | ||||
|                              ('NATIVE', 'Native')])), | ||||
|                 ('notified_serial', models.IntegerField(null=True)), | ||||
|                 ('customer', models.ForeignKey(verbose_name='customer', blank=True, to=settings.AUTH_USER_MODEL, null=True)), | ||||
|                 ('customer', models.ForeignKey( | ||||
|                     verbose_name='customer', blank=True, | ||||
|                     to=settings.AUTH_USER_MODEL, null=True, | ||||
|                     on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'DNS domain', | ||||
|  | @ -64,26 +85,35 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DNSDomainMetadata', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('kind', models.CharField(max_length=32)), | ||||
|                 ('content', models.TextField()), | ||||
|                 ('domain', models.ForeignKey(to='domains.DNSDomain')), | ||||
|                 ('domain', models.ForeignKey( | ||||
|                     to='domains.DNSDomain', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='DNSRecord', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('name', models.CharField(db_index=True, max_length=255, null=True, blank=True)), | ||||
|                 ('recordtype', models.CharField(max_length=10, null=True, db_column='type', blank=True)), | ||||
|                 ('content', models.CharField(max_length=65535, null=True, blank=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('name', models.CharField( | ||||
|                     db_index=True, max_length=255, null=True, blank=True)), | ||||
|                 ('recordtype', models.CharField( | ||||
|                     max_length=10, null=True, db_column='type', blank=True)), | ||||
|                 ('content', models.CharField( | ||||
|                     max_length=65535, null=True, blank=True)), | ||||
|                 ('ttl', models.IntegerField(null=True)), | ||||
|                 ('prio', models.IntegerField(null=True)), | ||||
|                 ('change_date', models.IntegerField(null=True)), | ||||
|                 ('disabled', models.BooleanField(default=False)), | ||||
|                 ('ordername', models.CharField(max_length=255)), | ||||
|                 ('auth', models.BooleanField(default=True)), | ||||
|                 ('domain', models.ForeignKey(to='domains.DNSDomain')), | ||||
|                 ('domain', models.ForeignKey( | ||||
|                     to='domains.DNSDomain', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'DNS record', | ||||
|  | @ -101,16 +131,22 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DNSSupermaster', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('ip', models.GenericIPAddressField()), | ||||
|                 ('nameserver', models.CharField(max_length=255)), | ||||
|                 ('customer', models.ForeignKey(verbose_name='customer', to=settings.AUTH_USER_MODEL)), | ||||
|                 ('customer', models.ForeignKey( | ||||
|                     verbose_name='customer', to=settings.AUTH_USER_MODEL, | ||||
|                     on_delete=models.CASCADE)), | ||||
|             ], | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='DNSTSIGKey', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, | ||||
|                     auto_created=True, primary_key=True)), | ||||
|                 ('name', models.CharField(max_length=255)), | ||||
|                 ('algorithm', models.CharField(max_length=50)), | ||||
|                 ('secret', models.CharField(max_length=255)), | ||||
|  | @ -123,22 +159,26 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             model_name='hostingdomain', | ||||
|             name='domain', | ||||
|             field=models.CharField(unique=True, max_length=255, verbose_name='domain name'), | ||||
|             field=models.CharField( | ||||
|                 unique=True, max_length=255, verbose_name='domain name'), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='maildomain', | ||||
|             name='domain', | ||||
|             field=models.CharField(unique=True, max_length=255, verbose_name='domain name'), | ||||
|             field=models.CharField( | ||||
|                 unique=True, max_length=255, verbose_name='domain name'), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='dnscryptokey', | ||||
|             name='domain', | ||||
|             field=models.ForeignKey(to='domains.DNSDomain'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='domains.DNSDomain', on_delete=models.CASCADE), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='dnscomment', | ||||
|             name='domain', | ||||
|             field=models.ForeignKey(to='domains.DNSDomain'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='domains.DNSDomain', on_delete=models.CASCADE), | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='dnssupermaster', | ||||
|  | @ -154,6 +194,6 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterIndexTogether( | ||||
|             name='dnscomment', | ||||
|             index_together=set([('name', 'commenttype'), ('domain', 'modified_at')]), | ||||
|             index_together={('name', 'commenttype'), ('domain', 'modified_at')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ class DomainBase(TimeStampedModel): | |||
|     domain = models.CharField(_('domain name'), max_length=255, unique=True) | ||||
|     customer = models.ForeignKey( | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer'), blank=True, | ||||
|         null=True) | ||||
|         null=True, on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         abstract = True | ||||
|  | @ -119,7 +119,8 @@ class HostingDomain(DomainBase): | |||
|     """ | ||||
|     maildomain = models.OneToOneField( | ||||
|         MailDomain, verbose_name=_('mail domain'), blank=True, null=True, | ||||
|         help_text=_('assigned mail domain for this domain') | ||||
|         help_text=_('assigned mail domain for this domain'), | ||||
|         on_delete=models.CASCADE, | ||||
|     ) | ||||
| 
 | ||||
|     objects = HostingDomainManager() | ||||
|  | @ -208,7 +209,7 @@ class DNSRecord(models.Model): | |||
|            domain_id, ordername text_pattern_ops); | ||||
| 
 | ||||
|     """ | ||||
|     domain = models.ForeignKey('DNSDomain') | ||||
|     domain = models.ForeignKey('DNSDomain', on_delete=models.CASCADE) | ||||
|     name = models.CharField( | ||||
|         max_length=255, blank=True, null=True, db_index=True) | ||||
|     recordtype = models.CharField( | ||||
|  | @ -255,7 +256,8 @@ class DNSSupermaster(models.Model): | |||
|     nameserver = models.CharField(max_length=255) | ||||
|     # account is replaced by customer | ||||
|     customer = models.ForeignKey( | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer')) | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer'), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         verbose_name = _('DNS supermaster') | ||||
|  | @ -299,13 +301,14 @@ class DNSComment(models.Model): | |||
|        CREATE INDEX comments_order_idx ON comments (domain_id, modified_at); | ||||
| 
 | ||||
|     """ | ||||
|     domain = models.ForeignKey('DNSDomain') | ||||
|     domain = models.ForeignKey('DNSDomain', on_delete=models.CASCADE) | ||||
|     name = models.CharField(max_length=255) | ||||
|     commenttype = models.CharField(max_length=10, db_column='type') | ||||
|     modified_at = models.IntegerField() | ||||
|     # account is replaced by customer | ||||
|     customer = models.ForeignKey( | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer')) | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer'), | ||||
|         on_delete=models.CASCADE) | ||||
|     comment = models.CharField(max_length=65535) | ||||
|     # check constraint is added via RunSQL in migration | ||||
| 
 | ||||
|  | @ -343,7 +346,7 @@ class DNSDomainMetadata(models.Model): | |||
|        CREATE INDEX domainidmetaindex ON domainmetadata(domain_id); | ||||
| 
 | ||||
|     """ | ||||
|     domain = models.ForeignKey('DNSDomain') | ||||
|     domain = models.ForeignKey('DNSDomain', on_delete=models.CASCADE) | ||||
|     kind = models.CharField(max_length=32, choices=DNS_DOMAIN_METADATA_KINDS) | ||||
|     content = models.TextField() | ||||
| 
 | ||||
|  | @ -376,7 +379,7 @@ class DNSCryptoKey(models.Model): | |||
|        CREATE INDEX domainidindex ON cryptokeys(domain_id); | ||||
| 
 | ||||
|     """ | ||||
|     domain = models.ForeignKey('DNSDomain') | ||||
|     domain = models.ForeignKey('DNSDomain', on_delete=models.CASCADE) | ||||
|     flags = models.IntegerField() | ||||
|     active = models.BooleanField(default=True) | ||||
|     content = models.TextField() | ||||
|  |  | |||
|  | @ -4,16 +4,13 @@ This module defines views related to domains. | |||
| """ | ||||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from braces.views import StaffuserRequiredMixin | ||||
| from django.contrib.auth.mixins import LoginRequiredMixin | ||||
| from django.shortcuts import redirect, get_object_or_404 | ||||
| from django.views.generic.edit import CreateView | ||||
| from django.utils.translation import ugettext as _ | ||||
| from django.contrib import messages | ||||
| 
 | ||||
| from braces.views import ( | ||||
|     LoginRequiredMixin, | ||||
|     StaffuserRequiredMixin, | ||||
| ) | ||||
| 
 | ||||
| from hostingpackages.models import CustomerHostingPackage | ||||
| 
 | ||||
| from .forms import CreateHostingDomainForm | ||||
|  |  | |||
|  | @ -38,7 +38,8 @@ DEBUG = False | |||
| # ######### MANAGER CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#admins | ||||
| ADMINS = ( | ||||
|     (get_env_variable('GVA_ADMIN_NAME'), get_env_variable('GVA_ADMIN_EMAIL')), | ||||
|     (get_env_variable('GVA_ADMIN_NAME', default='Admin'), | ||||
|      get_env_variable('GVA_ADMIN_EMAIL', default='admin@example.org')), | ||||
| ) | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers | ||||
|  | @ -50,12 +51,12 @@ MANAGERS = ADMINS | |||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases | ||||
| DATABASES = { | ||||
|     'default': { | ||||
|         'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||||
|         'NAME': get_env_variable('GVA_PGSQL_DATABASE'), | ||||
|         'USER': get_env_variable('GVA_PGSQL_USER'), | ||||
|         'ENGINE': 'django.db.backends.postgresql', | ||||
|         'NAME': get_env_variable('GVA_PGSQL_DATABASE', default='gnuviechadmin'), | ||||
|         'USER': get_env_variable('GVA_PGSQL_USER', default='gnuviechadmin'), | ||||
|         'PASSWORD': get_env_variable('GVA_PGSQL_PASSWORD'), | ||||
|         'HOST': get_env_variable('GVA_PGSQL_HOSTNAME'), | ||||
|         'PORT': get_env_variable('GVA_PGSQL_PORT'), | ||||
|         'HOST': get_env_variable('GVA_PGSQL_HOSTNAME', default='db'), | ||||
|         'PORT': get_env_variable('GVA_PGSQL_PORT', int, default=5432), | ||||
|     } | ||||
| } | ||||
| # ######### END DATABASE CONFIGURATION | ||||
|  | @ -98,16 +99,13 @@ MEDIA_URL = '/media/' | |||
| # ######### END MEDIA CONFIGURATION | ||||
| 
 | ||||
| 
 | ||||
| # ######### STATIC FILE CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root | ||||
| STATIC_ROOT = normpath(join(SITE_ROOT, 'assets')) | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url | ||||
| STATIC_URL = '/static/' | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS  # noqa | ||||
| STATICFILES_DIRS = ( | ||||
|     normpath(join(SITE_ROOT, 'static')), | ||||
|     normpath(join(SITE_ROOT, 'gnuviechadmin', 'assets')), | ||||
| ) | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders  # noqa | ||||
|  | @ -146,7 +144,7 @@ TEMPLATES = [ | |||
|     { | ||||
|         'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||||
|         'DIRS': [ | ||||
|             normpath(join(SITE_ROOT, 'templates')), | ||||
|             normpath(join(DJANGO_ROOT, 'templates')), | ||||
|         ], | ||||
|         'APP_DIRS': True, | ||||
|         'OPTIONS': { | ||||
|  | @ -171,7 +169,7 @@ TEMPLATES = [ | |||
| 
 | ||||
| # ######### MIDDLEWARE CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes | ||||
| MIDDLEWARE_CLASSES = ( | ||||
| MIDDLEWARE = [ | ||||
|     # Default Django middleware. | ||||
|     'django.middleware.common.CommonMiddleware', | ||||
|     'django.contrib.sessions.middleware.SessionMiddleware', | ||||
|  | @ -181,7 +179,7 @@ MIDDLEWARE_CLASSES = ( | |||
|     # uncomment next line to enable translation to browser locale | ||||
|     'django.middleware.locale.LocaleMiddleware', | ||||
|     'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||||
| ) | ||||
| ] | ||||
| # ######### END MIDDLEWARE CONFIGURATION | ||||
| 
 | ||||
| 
 | ||||
|  | @ -330,8 +328,12 @@ WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME | |||
| 
 | ||||
| 
 | ||||
| # ######### CELERY CONFIGURATION | ||||
| BROKER_URL = get_env_variable('GVA_BROKER_URL') | ||||
| CELERY_RESULT_BACKEND = get_env_variable('GVA_RESULTS_REDIS_URL') | ||||
| BROKER_URL = get_env_variable( | ||||
|     'GVA_BROKER_URL', | ||||
|     default='amqp://gnuviechadmin:gnuviechadmin@mq/gnuviechadmin') | ||||
| CELERY_RESULT_BACKEND = get_env_variable( | ||||
|     'GVA_RESULTS_REDIS_URL', | ||||
|     default='redis://:gnuviechadmin@redis:6379/0') | ||||
| CELERY_TASK_RESULT_EXPIRES = None | ||||
| CELERY_ROUTES = ( | ||||
|     'gvacommon.celeryrouters.GvaRouter', | ||||
|  | @ -345,17 +347,134 @@ CELERY_RESULT_SERIALIZER = 'json' | |||
| 
 | ||||
| 
 | ||||
| # ######### CUSTOM APP CONFIGURATION | ||||
| OSUSER_MINUID = int(get_env_variable('GVA_MIN_OS_UID')) | ||||
| OSUSER_MINGID = int(get_env_variable('GVA_MIN_OS_GID')) | ||||
| OSUSER_USERNAME_PREFIX = get_env_variable('GVA_OSUSER_PREFIX') | ||||
| OSUSER_HOME_BASEPATH = get_env_variable('GVA_OSUSER_HOME_BASEPATH') | ||||
| OSUSER_DEFAULT_SHELL = get_env_variable('GVA_OSUSER_DEFAULT_SHELL') | ||||
| OSUSER_MINUID = get_env_variable('GVA_MIN_OS_UID', int, default=10000) | ||||
| OSUSER_MINGID = get_env_variable('GVA_MIN_OS_GID', int, default=10000) | ||||
| OSUSER_USERNAME_PREFIX = get_env_variable('GVA_OSUSER_PREFIX', default='usr') | ||||
| OSUSER_HOME_BASEPATH = get_env_variable( | ||||
|     'GVA_OSUSER_HOME_BASEPATH', default='/home') | ||||
| OSUSER_DEFAULT_SHELL = get_env_variable( | ||||
|     'GVA_OSUSER_DEFAULT_SHELL', default='/usr/bin/rssh') | ||||
| OSUSER_SFTP_GROUP = 'sftponly' | ||||
| OSUSER_SSH_GROUP = 'sshusers' | ||||
| OSUSER_DEFAULT_GROUPS = [OSUSER_SFTP_GROUP] | ||||
| OSUSER_UPLOAD_SERVER = get_env_variable('GVA_OSUSER_UPLOADSERVER') | ||||
| OSUSER_UPLOAD_SERVER = get_env_variable( | ||||
|     'GVA_OSUSER_UPLOADSERVER', default='file') | ||||
| 
 | ||||
| GVA_LINK_WEBMAIL = get_env_variable('GVA_WEBMAIL_URL') | ||||
| GVA_LINK_PHPMYADMIN = get_env_variable('GVA_PHPMYADMIN_URL') | ||||
| GVA_LINK_PHPPGADMIN = get_env_variable('GVA_PHPPGADMIN_URL') | ||||
| GVA_LINK_WEBMAIL = get_env_variable( | ||||
|     'GVA_WEBMAIL_URL', default='https://webmail.example.org/') | ||||
| GVA_LINK_PHPMYADMIN = get_env_variable( | ||||
|     'GVA_PHPMYADMIN_URL', default='https://phpmyadmin.example.org/') | ||||
| GVA_LINK_PHPPGADMIN = get_env_variable( | ||||
|     'GVA_PHPPGADMIN_URL', default='https://phppgadmin.example.org/') | ||||
| # ######### END CUSTOM APP CONFIGURATION | ||||
| 
 | ||||
| GVA_ENVIRONMENT = get_env_variable('GVA_ENVIRONMENT', default='prod') | ||||
| 
 | ||||
| # ######### STATIC FILE CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root | ||||
| STATIC_ROOT = '/srv/gnuviechadmin/static/' | ||||
| 
 | ||||
| if GVA_ENVIRONMENT == 'local': | ||||
|     # ######### DEBUG CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug | ||||
|     DEBUG = True | ||||
|      | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug | ||||
|     TEMPLATES[0]['OPTIONS']['debug'] = DEBUG | ||||
|     # ######### END DEBUG CONFIGURATION | ||||
|      | ||||
|     # ######### EMAIL CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||||
|     EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | ||||
|     # ######### END EMAIL CONFIGURATION | ||||
|      | ||||
|     # ######### CACHE CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches | ||||
|     CACHES = { | ||||
|         'default': { | ||||
|             'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | ||||
|         } | ||||
|     } | ||||
|     # ######### END CACHE CONFIGURATION | ||||
|      | ||||
|     # ######### TOOLBAR CONFIGURATION | ||||
|     # See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#explicit-setup # noqa | ||||
|     INSTALLED_APPS += ( | ||||
|         'debug_toolbar', | ||||
|     ) | ||||
|      | ||||
|     MIDDLEWARE += [ | ||||
|         'debug_toolbar.middleware.DebugToolbarMiddleware', | ||||
|     ] | ||||
|      | ||||
|     LOGGING['handlers'].update({ | ||||
|         'console': { | ||||
|             'level': 'DEBUG', | ||||
|             'class': 'logging.StreamHandler', | ||||
|             'formatter': 'simple', | ||||
|         } | ||||
|     }) | ||||
|     LOGGING['loggers'].update(dict( | ||||
|         [(key, {'handlers': ['console'], 'level': 'DEBUG', 'propagate': True, }) | ||||
|             for key in [ | ||||
|                 'dashboard', 'domains', 'fileservertasks', 'gvacommon', | ||||
|                 'gvawebcore', 'hostingpackages', 'ldaptasks', 'managemails', | ||||
|                 'mysqltasks', 'osusers', 'pgsqltasks', 'taskresults', | ||||
|                 'userdbs', 'websites']])) | ||||
|      | ||||
|     DEBUG_TOOLBAR_PATCH_SETTINGS = False | ||||
|      | ||||
|     # http://django-debug-toolbar.readthedocs.org/en/latest/installation.html | ||||
|     INTERNAL_IPS = ('127.0.0.1', '10.0.2.2') | ||||
|     # ######### END TOOLBAR CONFIGURATION | ||||
| elif GVA_ENVIRONMENT == 'test': | ||||
|     PASSWORD_HASHERS = ( | ||||
|         'django.contrib.auth.hashers.MD5PasswordHasher', | ||||
|     ) | ||||
|     LOGGING['handlers'].update({ | ||||
|         'console': { | ||||
|             'level': 'ERROR', | ||||
|             'class': 'logging.StreamHandler', | ||||
|             'formatter': 'simple', | ||||
|         } | ||||
|     }) | ||||
|     LOGGING['loggers'].update(dict( | ||||
|         [(key, {'handlers': ['console'], 'level': 'ERROR', 'propagate': True, }) | ||||
|             for key in [ | ||||
|                 'dashboard', 'domains', 'fileservertasks', 'gvacommon', | ||||
|                 'gvawebcore', 'hostingpackages', 'ldaptasks', 'managemails', | ||||
|                 'mysqltasks', 'osusers', 'pgsqltasks', 'taskresults', | ||||
|                 'userdbs', 'websites']])) | ||||
|     BROKER_URL = BROKER_URL + '_test' | ||||
|     CELERY_RESULT_PERSISTENT = False | ||||
| else: | ||||
|     # ######### HOST CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production # noqa | ||||
|     ALLOWED_HOSTS = [SITES_DOMAIN_NAME] | ||||
|     # ######### END HOST CONFIGURATION | ||||
| 
 | ||||
|     # ######### EMAIL CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||||
|     EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||||
| 
 | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix | ||||
|     EMAIL_SUBJECT_PREFIX = '[%s] ' % SITE_NAME | ||||
| 
 | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email | ||||
|     DEFAULT_FROM_EMAIL = get_env_variable( | ||||
|         'GVA_SITE_ADMINMAIL', default='admin@example.org') | ||||
| 
 | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email | ||||
|     SERVER_EMAIL = get_env_variable( | ||||
|         'GVA_SITE_ADMINMAIL', default='admin@example.org') | ||||
|     # ######### END EMAIL CONFIGURATION | ||||
| 
 | ||||
|     # ######### CACHE CONFIGURATION | ||||
|     # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches | ||||
|     # CACHES = {} | ||||
|     # ######### END CACHE CONFIGURATION | ||||
| 
 | ||||
|     # ######### ALLAUTH PRODUCTION CONFIGURATION | ||||
|     ACCOUNT_EMAIL_SUBJECT_PREFIX = '[Jan Dittberner IT-Consulting & -Solutions] ' | ||||
|     ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https' | ||||
|     # ######### END ALLAUTH PRODUCTION CONFIGURATION | ||||
|  | @ -1,3 +0,0 @@ | |||
| """ | ||||
| This module contains settings for various environments. | ||||
| """ | ||||
|  | @ -1,68 +0,0 @@ | |||
| # -*- python -*- | ||||
| # pymode:lint_ignore=W0401,E501 | ||||
| """ | ||||
| Development settings and globals based on :py:mod:`gvaldap.settings.base`. | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
| from __future__ import absolute_import | ||||
| 
 | ||||
| # use import * to import all settings from base | ||||
| from .base import *  # NOQA | ||||
| 
 | ||||
| 
 | ||||
| # ######### DEBUG CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug | ||||
| DEBUG = True | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug | ||||
| TEMPLATES[0]['OPTIONS']['debug'] = DEBUG | ||||
| # ######### END DEBUG CONFIGURATION | ||||
| 
 | ||||
| 
 | ||||
| # ######### EMAIL CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||||
| EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | ||||
| # ######### END EMAIL CONFIGURATION | ||||
| 
 | ||||
| 
 | ||||
| # ######### CACHE CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches | ||||
| CACHES = { | ||||
|     'default': { | ||||
|         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | ||||
|     } | ||||
| } | ||||
| # ######### END CACHE CONFIGURATION | ||||
| 
 | ||||
| 
 | ||||
| # ######### TOOLBAR CONFIGURATION | ||||
| # See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#explicit-setup # noqa | ||||
| INSTALLED_APPS += ( | ||||
|     'debug_toolbar', | ||||
| ) | ||||
| 
 | ||||
| MIDDLEWARE_CLASSES += ( | ||||
|     'debug_toolbar.middleware.DebugToolbarMiddleware', | ||||
| ) | ||||
| 
 | ||||
| LOGGING['handlers'].update({ | ||||
|     'console': { | ||||
|         'level': 'DEBUG', | ||||
|         'class': 'logging.StreamHandler', | ||||
|         'formatter': 'simple', | ||||
|     } | ||||
| }) | ||||
| LOGGING['loggers'].update(dict( | ||||
|     [(key, {'handlers': ['console'], 'level': 'DEBUG', 'propagate': True, }) | ||||
|         for key in [ | ||||
|             'dashboard', 'domains', 'fileservertasks', 'gvacommon', | ||||
|             'gvawebcore', 'hostingpackages', 'ldaptasks', 'managemails', | ||||
|             'mysqltasks', 'osusers', 'pgsqltasks', 'taskresults', | ||||
|             'userdbs', 'websites']])) | ||||
| 
 | ||||
| DEBUG_TOOLBAR_PATCH_SETTINGS = False | ||||
| 
 | ||||
| # http://django-debug-toolbar.readthedocs.org/en/latest/installation.html | ||||
| INTERNAL_IPS = ('127.0.0.1', '10.0.2.2') | ||||
| # ######### END TOOLBAR CONFIGURATION | ||||
|  | @ -1,40 +0,0 @@ | |||
| # -*- python -*- | ||||
| # pymode:lint_ignore=W0401,E501 | ||||
| """ | ||||
| Production settings and globals based on :py:mod:`gvaldap.settings.base`. | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
| from __future__ import absolute_import | ||||
| 
 | ||||
| # use import * to import all settings from base | ||||
| from .base import *  # NOQA | ||||
| 
 | ||||
| # ######### HOST CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production # noqa | ||||
| ALLOWED_HOSTS = [SITES_DOMAIN_NAME] | ||||
| # ######### END HOST CONFIGURATION | ||||
| 
 | ||||
| # ######### EMAIL CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||||
| EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix | ||||
| EMAIL_SUBJECT_PREFIX = '[%s] ' % SITE_NAME | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email | ||||
| DEFAULT_FROM_EMAIL = get_env_variable('GVA_SITE_ADMINMAIL') | ||||
| 
 | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email | ||||
| SERVER_EMAIL = get_env_variable('GVA_SITE_ADMINMAIL') | ||||
| # ######### END EMAIL CONFIGURATION | ||||
| 
 | ||||
| # ######### CACHE CONFIGURATION | ||||
| # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches | ||||
| # CACHES = {} | ||||
| # ######### END CACHE CONFIGURATION | ||||
| 
 | ||||
| # ######### ALLAUTH PRODUCTION CONFIGURATION | ||||
| ACCOUNT_EMAIL_SUBJECT_PREFIX = '[Jan Dittberner IT-Consulting & -Solutions] ' | ||||
| ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https' | ||||
| # ######### END ALLAUTH PRODUCTION CONFIGURATION | ||||
|  | @ -1,29 +0,0 @@ | |||
| # pymode:lint_ignore=W0401 | ||||
| """ | ||||
| Test settings based on :py:mod:`gvaldap.settings.base`. | ||||
| 
 | ||||
| """ | ||||
| from __future__ import absolute_import | ||||
| 
 | ||||
| # use import * to import all settings from base | ||||
| from .base import *  # NOQA | ||||
| 
 | ||||
| PASSWORD_HASHERS = ( | ||||
|     'django.contrib.auth.hashers.MD5PasswordHasher', | ||||
| ) | ||||
| LOGGING['handlers'].update({ | ||||
|     'console': { | ||||
|         'level': 'ERROR', | ||||
|         'class': 'logging.StreamHandler', | ||||
|         'formatter': 'simple', | ||||
|     } | ||||
| }) | ||||
| LOGGING['loggers'].update(dict( | ||||
|     [(key, {'handlers': ['console'], 'level': 'ERROR', 'propagate': True, }) | ||||
|         for key in [ | ||||
|             'dashboard', 'domains', 'fileservertasks', 'gvacommon', | ||||
|             'gvawebcore', 'hostingpackages', 'ldaptasks', 'managemails', | ||||
|             'mysqltasks', 'osusers', 'pgsqltasks', 'taskresults', | ||||
|             'userdbs', 'websites']])) | ||||
| BROKER_URL = BROKER_URL + '_test' | ||||
| CELERY_RESULT_PERSISTENT = False | ||||
|  | @ -5,6 +5,8 @@ from django.conf import settings | |||
| 
 | ||||
| from django.contrib import admin | ||||
| from django.contrib.flatpages import views | ||||
| from django.contrib.staticfiles.urls import staticfiles_urlpatterns | ||||
| 
 | ||||
| admin.autodiscover() | ||||
| 
 | ||||
| urlpatterns = [ | ||||
|  | @ -28,6 +30,7 @@ urlpatterns = [ | |||
| 
 | ||||
| if settings.DEBUG:  # pragma: no cover | ||||
|     import debug_toolbar | ||||
|     urlpatterns += [ | ||||
|         url(r'^__debug__/', debug_toolbar.urls), | ||||
|     ] | ||||
| 
 | ||||
|     urlpatterns = [ | ||||
|         url(r'^__debug__/', include(debug_toolbar.urls)), | ||||
|     ] + staticfiles_urlpatterns() + urlpatterns | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ This module contains the form classes related to hosting packages. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext as _ | ||||
| 
 | ||||
| from crispy_forms.helper import FormHelper | ||||
|  |  | |||
|  | @ -1,14 +1,13 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| from django.conf import settings | ||||
| import model_utils.fields | ||||
| from django.conf import settings | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||||
|     ] | ||||
|  | @ -17,15 +16,30 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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)), | ||||
|                 ('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', | ||||
|  | @ -36,9 +50,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -49,9 +69,16 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='CustomerDiskSpaceOption', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -59,13 +86,19 @@ class Migration(migrations.Migration): | |||
|                 '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', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -73,14 +106,22 @@ class Migration(migrations.Migration): | |||
|                 'verbose_name': 'Mailbox option', | ||||
|                 'verbose_name_plural': 'Mailbox options', | ||||
|             }, | ||||
|             bases=('hostingpackages.customerhostingpackageoption', models.Model), | ||||
|             bases=( | ||||
|                 'hostingpackages.customerhostingpackageoption', models.Model), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='CustomerUserDatabaseOption', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -88,14 +129,21 @@ class Migration(migrations.Migration): | |||
|                 'verbose_name': 'Database option', | ||||
|                 'verbose_name_plural': 'Database options', | ||||
|             }, | ||||
|             bases=('hostingpackages.customerhostingpackageoption', models.Model), | ||||
|             bases=( | ||||
|                 'hostingpackages.customerhostingpackageoption', models.Model), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -106,9 +154,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DiskSpaceOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -121,14 +175,27 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -139,8 +206,12 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='MailboxOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -153,9 +224,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='UserDatabaseOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -167,48 +244,71 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='userdatabaseoption', | ||||
|             unique_together=set([('number', 'db_type')]), | ||||
|             unique_together={('number', 'db_type')}, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='diskspaceoption', | ||||
|             unique_together=set([('diskspace', 'diskspace_unit')]), | ||||
|             unique_together={('diskspace', 'diskspace_unit')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='customeruserdatabaseoption', | ||||
|             unique_together=set([('number', 'db_type')]), | ||||
|             unique_together={('number', 'db_type')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='customerhostingpackageoption', | ||||
|             name='hosting_package', | ||||
|             field=models.ForeignKey(verbose_name='hosting package', to='hostingpackages.CustomerHostingPackage'), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='hosting package', | ||||
|                 to='hostingpackages.CustomerHostingPackage', | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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.'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='customerdiskspaceoption', | ||||
|             unique_together=set([('diskspace', 'diskspace_unit')]), | ||||
|             unique_together={('diskspace', 'diskspace_unit')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,15 +1,18 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| from django.conf import settings | ||||
| import model_utils.fields | ||||
| from django.conf import settings | ||||
| 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), | ||||
|  | @ -20,15 +23,30 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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)), | ||||
|                 ('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', | ||||
|  | @ -39,9 +57,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -52,9 +76,17 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='CustomerDiskSpaceOption', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -62,13 +94,20 @@ class Migration(migrations.Migration): | |||
|                 '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', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -76,14 +115,23 @@ class Migration(migrations.Migration): | |||
|                 'verbose_name': 'Mailbox option', | ||||
|                 'verbose_name_plural': 'Mailbox options', | ||||
|             }, | ||||
|             bases=('hostingpackages.customerhostingpackageoption', models.Model), | ||||
|             bases=( | ||||
|                 'hostingpackages.customerhostingpackageoption', models.Model), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='CustomerUserDatabaseOption', | ||||
|             fields=[ | ||||
|                 ('customerhostingpackageoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.CustomerHostingPackageOption')), | ||||
|                 ('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'], | ||||
|  | @ -91,14 +139,21 @@ class Migration(migrations.Migration): | |||
|                 'verbose_name': 'Database option', | ||||
|                 'verbose_name_plural': 'Database options', | ||||
|             }, | ||||
|             bases=('hostingpackages.customerhostingpackageoption', models.Model), | ||||
|             bases=( | ||||
|                 'hostingpackages.customerhostingpackageoption', models.Model), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -109,9 +164,16 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DiskSpaceOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -124,14 +186,27 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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', | ||||
|  | @ -142,8 +217,13 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='MailboxOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -156,9 +236,17 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='UserDatabaseOption', | ||||
|             fields=[ | ||||
|                 ('hostingoption_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='hostingpackages.HostingOption')), | ||||
|                 ('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'], | ||||
|  | @ -170,60 +258,93 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='userdatabaseoption', | ||||
|             unique_together=set([('number', 'db_type')]), | ||||
|             unique_together={('number', 'db_type')}, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='diskspaceoption', | ||||
|             unique_together=set([('diskspace', 'diskspace_unit')]), | ||||
|             unique_together={('diskspace', 'diskspace_unit')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='customeruserdatabaseoption', | ||||
|             unique_together=set([('number', 'db_type')]), | ||||
|             unique_together={('number', 'db_type')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='customerhostingpackageoption', | ||||
|             name='hosting_package', | ||||
|             field=models.ForeignKey(verbose_name='hosting package', to='hostingpackages.CustomerHostingPackage'), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='hosting package', | ||||
|                 to='hostingpackages.CustomerHostingPackage', | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='customerdiskspaceoption', | ||||
|             unique_together=set([('diskspace', 'diskspace_unit')]), | ||||
|             unique_together={('diskspace', 'diskspace_unit')}, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|  | @ -234,12 +355,14 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='customerhostingpackage', | ||||
|             unique_together=set([('customer', 'name')]), | ||||
|             unique_together={('customer', 'name')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='customerhostingpackage', | ||||
|             name='osuser', | ||||
|             field=models.OneToOneField(null=True, blank=True, to='osusers.User', verbose_name='Operating system user'), | ||||
|             field=models.OneToOneField( | ||||
|                 null=True, blank=True, to='osusers.User', | ||||
|                 verbose_name='Operating system user', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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', '0001_initial'), | ||||
|     ] | ||||
|  | @ -14,25 +13,45 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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_1319'), | ||||
|     ] | ||||
|  | @ -14,7 +13,12 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             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'), | ||||
|             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), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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 = [ | ||||
|         ('osusers', '0004_auto_20150104_1751'), | ||||
|         ('hostingpackages', '0003_auto_20150118_1221'), | ||||
|  | @ -15,7 +14,9 @@ class Migration(migrations.Migration): | |||
|         migrations.AddField( | ||||
|             model_name='customerhostingpackage', | ||||
|             name='osuser', | ||||
|             field=models.ForeignKey(verbose_name='Operating system user', blank=True, to='osusers.User', null=True), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='Operating system user', blank=True, | ||||
|                 to='osusers.User', null=True, on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,13 +1,12 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| import model_utils.fields | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('domains', '0002_auto_20150124_1909'), | ||||
|         ('hostingpackages', '0003_auto_20150118_1407'), | ||||
|  | @ -17,11 +16,22 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             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')), | ||||
|                 ('hosting_package', models.ForeignKey(related_name='domains', verbose_name='hosting package', to='hostingpackages.CustomerHostingPackage')), | ||||
|                 ('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, | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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', '0004_customerhostingpackage_osuser'), | ||||
|     ] | ||||
|  | @ -14,7 +13,9 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             model_name='customerhostingpackage', | ||||
|             name='osuser', | ||||
|             field=models.OneToOneField(null=True, blank=True, to='osusers.User', verbose_name='Operating system user'), | ||||
|             field=models.OneToOneField( | ||||
|                 null=True, blank=True, to='osusers.User', | ||||
|                 verbose_name='Operating system user', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -5,9 +5,9 @@ This module contains the hosting package models. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django.conf import settings | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.db import transaction | ||||
| from django.db import models | ||||
| from django.urls import reverse | ||||
| from django.utils.encoding import python_2_unicode_compatible | ||||
| from django.utils.translation import ugettext_lazy as _, ungettext | ||||
| 
 | ||||
|  | @ -26,7 +26,6 @@ from userdbs.models import ( | |||
|     UserDatabase, | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
| DISK_SPACE_UNITS = Choices( | ||||
|     (0, 'M', _('MiB')), | ||||
|     (1, 'G', _('GiB')), | ||||
|  | @ -94,6 +93,7 @@ class DiskSpaceOption(DiskSpaceOptionBase, HostingOption): | |||
|     existing hosting packages. | ||||
| 
 | ||||
|     """ | ||||
| 
 | ||||
|     class Meta: | ||||
|         unique_together = ['diskspace', 'diskspace_unit'] | ||||
| 
 | ||||
|  | @ -127,6 +127,7 @@ class UserDatabaseOption(UserDatabaseOptionBase, HostingOption): | |||
|     hosting packages. | ||||
| 
 | ||||
|     """ | ||||
| 
 | ||||
|     class Meta: | ||||
|         unique_together = ['number', 'db_type'] | ||||
| 
 | ||||
|  | @ -203,17 +204,19 @@ class CustomerHostingPackage(HostingPackageBase): | |||
| 
 | ||||
|     """ | ||||
|     customer = models.ForeignKey( | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer')) | ||||
|         settings.AUTH_USER_MODEL, verbose_name=_('customer'), | ||||
|         on_delete=models.CASCADE) | ||||
|     template = models.ForeignKey( | ||||
|         HostingPackageTemplate, verbose_name=_('hosting package template'), | ||||
|         help_text=_( | ||||
|             'The hosting package template that this hosting package is based' | ||||
|             ' on' | ||||
|         )) | ||||
|         ), | ||||
|         on_delete=models.CASCADE) | ||||
|     name = models.CharField(_('name'), max_length=128) | ||||
|     osuser = models.OneToOneField( | ||||
|         OsUser, verbose_name=_('Operating system user'), | ||||
|         blank=True, null=True) | ||||
|         blank=True, null=True, on_delete=models.CASCADE) | ||||
| 
 | ||||
|     objects = CustomerHostingPackageManager() | ||||
| 
 | ||||
|  | @ -250,6 +253,7 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|         ]: | ||||
|             opts.extend(opt_type.objects.filter(hosting_package=self)) | ||||
|         return opts | ||||
| 
 | ||||
|     hostingoptions = property(get_hostingoptions) | ||||
| 
 | ||||
|     def get_disk_space(self, unit=None): | ||||
|  | @ -272,15 +276,16 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|                 diskspace += option.diskspace | ||||
|             elif option.diskspace_unit > min_unit: | ||||
|                 diskspace += ( | ||||
|                     DISK_SPACE_FACTORS[option.diskspace_unit][min_unit] * | ||||
|                     option.diskspace) | ||||
|                         DISK_SPACE_FACTORS[option.diskspace_unit][min_unit] * | ||||
|                         option.diskspace) | ||||
|             else: | ||||
|                 diskspace = ( | ||||
|                     DISK_SPACE_FACTORS[min_unit][option.diskspace_unit] * | ||||
|                     diskspace) + option.diskspace | ||||
|                                     DISK_SPACE_FACTORS[min_unit][ | ||||
|                                         option.diskspace_unit] * | ||||
|                                     diskspace) + 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 | ||||
|  | @ -298,7 +303,7 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|         """ | ||||
|         if unit is None: | ||||
|             return (DISK_SPACE_FACTORS[self.diskspace_unit][0] * | ||||
|                     self.diskspace * 1024**2) | ||||
|                     self.diskspace * 1024 ** 2) | ||||
|         if unit > self.diskspace_unit: | ||||
|             return (DISK_SPACE_FACTORS[unit][self.diskspace_unit] * | ||||
|                     self.diskspace) | ||||
|  | @ -312,6 +317,7 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|     def get_mailboxes(self): | ||||
|         if self.osuser: | ||||
|             return Mailbox.objects.filter(osuser=self.osuser).all() | ||||
| 
 | ||||
|     mailboxes = property(get_mailboxes) | ||||
| 
 | ||||
|     def get_used_mailbox_count(self): | ||||
|  | @ -322,6 +328,7 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|         if self.osuser: | ||||
|             return Mailbox.objects.filter(osuser=self.osuser).count() | ||||
|         return 0 | ||||
| 
 | ||||
|     used_mailbox_count = property(get_used_mailbox_count) | ||||
| 
 | ||||
|     def get_mailbox_count(self): | ||||
|  | @ -336,6 +343,7 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|             mailbox_sum=models.Sum('number') | ||||
|         ) | ||||
|         return self.mailboxcount + (result['mailbox_sum'] or 0) | ||||
| 
 | ||||
|     mailbox_count = property(get_mailbox_count) | ||||
| 
 | ||||
|     def may_add_mailbox(self): | ||||
|  | @ -357,14 +365,15 @@ class CustomerHostingPackage(HostingPackageBase): | |||
|         if self.osuser: | ||||
|             return UserDatabase.objects.filter( | ||||
|                 db_user__osuser=self.osuser).all() | ||||
| 
 | ||||
|     databases = property(get_databases_flat) | ||||
| 
 | ||||
|     def may_add_database(self): | ||||
|         return ( | ||||
|             CustomerUserDatabaseOption.objects.filter( | ||||
|                 hosting_package=self).count() > | ||||
|             UserDatabase.objects.filter( | ||||
|                 db_user__osuser=self.osuser).count() | ||||
|                 CustomerUserDatabaseOption.objects.filter( | ||||
|                     hosting_package=self).count() > | ||||
|                 UserDatabase.objects.filter( | ||||
|                     db_user__osuser=self.osuser).count() | ||||
|         ) | ||||
| 
 | ||||
|     @transaction.atomic | ||||
|  | @ -402,9 +411,10 @@ class CustomerHostingPackageDomain(TimeStampedModel): | |||
|     """ | ||||
|     hosting_package = models.ForeignKey( | ||||
|         CustomerHostingPackage, verbose_name=_('hosting package'), | ||||
|         related_name='domains') | ||||
|         related_name='domains', on_delete=models.CASCADE) | ||||
|     domain = models.OneToOneField( | ||||
|         HostingDomain, verbose_name=_('hosting domain')) | ||||
|         HostingDomain, verbose_name=_('hosting domain'), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return self.domain.domain | ||||
|  | @ -423,7 +433,8 @@ class CustomerHostingPackageOption(TimeStampedModel): | |||
| 
 | ||||
|     """ | ||||
|     hosting_package = models.ForeignKey( | ||||
|         CustomerHostingPackage, verbose_name=_('hosting package')) | ||||
|         CustomerHostingPackage, verbose_name=_('hosting package'), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         verbose_name = _('customer hosting option') | ||||
|  | @ -443,7 +454,8 @@ class CustomerDiskSpaceOption(DiskSpaceOptionBase, | |||
|         help_text=_( | ||||
|             'The disk space option template that this disk space option is' | ||||
|             ' based on' | ||||
|         )) | ||||
|         ), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
| 
 | ||||
| class CustomerUserDatabaseOption(UserDatabaseOptionBase, | ||||
|  | @ -459,7 +471,8 @@ class CustomerUserDatabaseOption(UserDatabaseOptionBase, | |||
|         help_text=_( | ||||
|             'The user database option template that this database option is' | ||||
|             ' based on' | ||||
|         )) | ||||
|         ), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
| 
 | ||||
| class CustomerMailboxOption(MailboxOptionBase, | ||||
|  | @ -474,4 +487,5 @@ class CustomerMailboxOption(MailboxOptionBase, | |||
|         verbose_name=_('mailbox option template'), | ||||
|         help_text=_( | ||||
|             'The mailbox option template that this mailbox option is based on' | ||||
|         )) | ||||
|         ), | ||||
|         on_delete=models.CASCADE) | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ This module defines form classes for mailbox and mail address editing. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.core.validators import validate_email | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | ||||
| from crispy_forms.helper import FormHelper | ||||
|  |  | |||
|  | @ -1,13 +1,12 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| import model_utils.fields | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('domains', '0001_initial'), | ||||
|         ('osusers', '0001_initial'), | ||||
|  | @ -17,9 +16,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='MailAddress', | ||||
|             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)), | ||||
|                 ('active', models.BooleanField(default=True)), | ||||
|                 ('localpart', models.CharField(max_length=128)), | ||||
|             ], | ||||
|  | @ -32,9 +37,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='MailAddressForward', | ||||
|             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)), | ||||
|                 ('target', models.EmailField(max_length=254)), | ||||
|             ], | ||||
|             options={ | ||||
|  | @ -44,9 +55,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='MailAddressMailbox', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('mailaddress', models.OneToOneField(primary_key=True, serialize=False, to='managemails.MailAddress')), | ||||
|                 ('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)), | ||||
|                 ('mailaddress', models.OneToOneField( | ||||
|                     primary_key=True, serialize=False, | ||||
|                     to='managemails.MailAddress', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|             }, | ||||
|  | @ -55,13 +72,20 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='Mailbox', | ||||
|             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)), | ||||
|                 ('active', models.BooleanField(default=True)), | ||||
|                 ('username', models.CharField(unique=True, max_length=128)), | ||||
|                 ('password', models.CharField(max_length=255)), | ||||
|                 ('osuser', models.ForeignKey(to='osusers.User')), | ||||
|                 ('osuser', models.ForeignKey( | ||||
|                     to='osusers.User', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'Mailbox', | ||||
|  | @ -72,31 +96,34 @@ class Migration(migrations.Migration): | |||
|         migrations.AddField( | ||||
|             model_name='mailaddressmailbox', | ||||
|             name='mailbox', | ||||
|             field=models.ForeignKey(to='managemails.Mailbox'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='managemails.Mailbox', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='mailaddressmailbox', | ||||
|             unique_together=set([('mailaddress', 'mailbox')]), | ||||
|             unique_together={('mailaddress', 'mailbox')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='mailaddressforward', | ||||
|             name='mailaddress', | ||||
|             field=models.ForeignKey(to='managemails.MailAddress'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='managemails.MailAddress', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='mailaddressforward', | ||||
|             unique_together=set([('mailaddress', 'target')]), | ||||
|             unique_together={('mailaddress', 'target')}, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='mailaddress', | ||||
|             name='domain', | ||||
|             field=models.ForeignKey(to='domains.MailDomain'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='domains.MailDomain', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='mailaddress', | ||||
|             unique_together=set([('localpart', 'domain')]), | ||||
|             unique_together={('localpart', 'domain')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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 = [ | ||||
|         ('managemails', '0002_auto_20150117_1238'), | ||||
|     ] | ||||
|  | @ -14,13 +13,17 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             model_name='mailaddressmailbox', | ||||
|             name='mailaddress', | ||||
|             field=models.OneToOneField(primary_key=True, serialize=False, to='managemails.MailAddress', verbose_name='mailaddress'), | ||||
|             field=models.OneToOneField( | ||||
|                 primary_key=True, serialize=False, to='managemails.MailAddress', | ||||
|                 verbose_name='mailaddress', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='mailaddressmailbox', | ||||
|             name='mailbox', | ||||
|             field=models.ForeignKey(verbose_name='mailbox', to='managemails.Mailbox'), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='mailbox', to='managemails.Mailbox', | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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 = [ | ||||
|         ('managemails', '0003_auto_20150124_2029'), | ||||
|     ] | ||||
|  | @ -14,7 +13,9 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             model_name='mailaddress', | ||||
|             name='domain', | ||||
|             field=models.ForeignKey(verbose_name='domain', to='domains.MailDomain'), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='domain', to='domains.MailDomain', | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|  |  | |||
|  | @ -109,7 +109,7 @@ class Mailbox(ActivateAbleMixin, TimeStampedModel): | |||
|     This is the model class for a mailbox. | ||||
| 
 | ||||
|     """ | ||||
|     osuser = models.ForeignKey(OsUser) | ||||
|     osuser = models.ForeignKey(OsUser, on_delete=models.CASCADE) | ||||
|     username = models.CharField(max_length=128, unique=True) | ||||
|     password = models.CharField(max_length=255) | ||||
| 
 | ||||
|  | @ -162,7 +162,8 @@ class MailAddress(ActivateAbleMixin, TimeStampedModel, models.Model): | |||
| 
 | ||||
|     """ | ||||
|     localpart = models.CharField(_('local part'), max_length=128) | ||||
|     domain = models.ForeignKey(MailDomain, verbose_name=_('domain')) | ||||
|     domain = models.ForeignKey( | ||||
|         MailDomain, verbose_name=_('domain'), on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         ordering = ['domain', 'localpart'] | ||||
|  | @ -250,8 +251,10 @@ class MailAddressMailbox(TimeStampedModel, models.Model): | |||
| 
 | ||||
|     """ | ||||
|     mailaddress = models.OneToOneField( | ||||
|         MailAddress, verbose_name=_('mailaddress'), primary_key=True) | ||||
|     mailbox = models.ForeignKey(Mailbox, verbose_name=_('mailbox')) | ||||
|         MailAddress, verbose_name=_('mailaddress'), primary_key=True, | ||||
|         on_delete=models.CASCADE) | ||||
|     mailbox = models.ForeignKey( | ||||
|         Mailbox, verbose_name=_('mailbox'), on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         unique_together = ('mailaddress', 'mailbox') | ||||
|  | @ -265,7 +268,7 @@ class MailAddressForward(TimeStampedModel, models.Model): | |||
|     This is a model class to map mail addresses to forwarding addresses. | ||||
| 
 | ||||
|     """ | ||||
|     mailaddress = models.ForeignKey(MailAddress) | ||||
|     mailaddress = models.ForeignKey(MailAddress, on_delete=models.CASCADE) | ||||
|     target = models.EmailField(max_length=254) | ||||
| 
 | ||||
|     class Meta: | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ This module defines operating system user related forms. | |||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | ||||
| from crispy_forms.helper import FormHelper | ||||
|  | @ -79,7 +79,7 @@ class AddSshPublicKeyForm(forms.ModelForm): | |||
|         keytext = self.cleaned_data.get('publickeytext') | ||||
|         try: | ||||
|             SshPublicKey.objects.parse_keytext(keytext) | ||||
|         except: | ||||
|         except ValueError: | ||||
|             raise forms.ValidationError(INVALID_SSH_PUBLIC_KEY) | ||||
|         return keytext | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,13 +1,12 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| import model_utils.fields | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|     ] | ||||
| 
 | ||||
|  | @ -15,9 +14,15 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='AdditionalGroup', | ||||
|             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': 'Additional group', | ||||
|  | @ -28,9 +33,14 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DeleteTaskResult', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('task_uuid', models.CharField(max_length=64, serialize=False, 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)), | ||||
|                 ('task_uuid', models.CharField( | ||||
|                     max_length=64, serialize=False, primary_key=True)), | ||||
|                 ('task_name', models.CharField(max_length=255, db_index=True)), | ||||
|                 ('is_finished', models.BooleanField(default=False)), | ||||
|                 ('is_success', models.BooleanField(default=False)), | ||||
|  | @ -47,12 +57,21 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='Group', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('groupname', models.CharField(unique=True, max_length=16, verbose_name='Group name')), | ||||
|                 ('gid', models.PositiveSmallIntegerField(unique=True, serialize=False, verbose_name='Group ID', primary_key=True)), | ||||
|                 ('descr', models.TextField(verbose_name='Description', blank=True)), | ||||
|                 ('passwd', models.CharField(max_length=128, verbose_name='Group password', blank=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)), | ||||
|                 ('groupname', models.CharField( | ||||
|                     unique=True, max_length=16, verbose_name='Group name')), | ||||
|                 ('gid', models.PositiveSmallIntegerField( | ||||
|                     unique=True, serialize=False, verbose_name='Group ID', | ||||
|                     primary_key=True)), | ||||
|                 ('descr', models.TextField( | ||||
|                     verbose_name='Description', blank=True)), | ||||
|                 ('passwd', models.CharField( | ||||
|                     max_length=128, verbose_name='Group password', blank=True)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'Group', | ||||
|  | @ -63,15 +82,21 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='GroupTaskResult', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('task_uuid', models.CharField(max_length=64, serialize=False, 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)), | ||||
|                 ('task_uuid', models.CharField( | ||||
|                     max_length=64, serialize=False, primary_key=True)), | ||||
|                 ('task_name', models.CharField(max_length=255, db_index=True)), | ||||
|                 ('is_finished', models.BooleanField(default=False)), | ||||
|                 ('is_success', models.BooleanField(default=False)), | ||||
|                 ('state', models.CharField(max_length=10)), | ||||
|                 ('result_body', models.TextField(blank=True)), | ||||
|                 ('group', models.ForeignKey(to='osusers.Group')), | ||||
|                 ('group', models.ForeignKey( | ||||
|                     to='osusers.Group', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|  | @ -81,13 +106,23 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='User', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('username', models.CharField(unique=True, max_length=64, verbose_name='User name')), | ||||
|                 ('uid', models.PositiveSmallIntegerField(unique=True, serialize=False, verbose_name='User ID', primary_key=True)), | ||||
|                 ('gecos', models.CharField(max_length=128, verbose_name='Gecos field', blank=True)), | ||||
|                 ('homedir', models.CharField(max_length=256, verbose_name='Home directory')), | ||||
|                 ('shell', models.CharField(max_length=64, verbose_name='Login shell')), | ||||
|                 ('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)), | ||||
|                 ('username', models.CharField( | ||||
|                     unique=True, max_length=64, verbose_name='User name')), | ||||
|                 ('uid', models.PositiveSmallIntegerField( | ||||
|                     unique=True, serialize=False, verbose_name='User ID', | ||||
|                     primary_key=True)), | ||||
|                 ('gecos', models.CharField( | ||||
|                     max_length=128, verbose_name='Gecos field', blank=True)), | ||||
|                 ('homedir', models.CharField( | ||||
|                     max_length=256, verbose_name='Home directory')), | ||||
|                 ('shell', models.CharField( | ||||
|                     max_length=64, verbose_name='Login shell')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'Benutzer', | ||||
|  | @ -98,16 +133,43 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='Shadow', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('user', models.OneToOneField(primary_key=True, serialize=False, to='osusers.User', verbose_name='Benutzer')), | ||||
|                 ('passwd', models.CharField(max_length=128, verbose_name='Encrypted password')), | ||||
|                 ('changedays', models.PositiveSmallIntegerField(help_text='This is expressed in days since Jan 1, 1970', null=True, verbose_name='Date of last change', blank=True)), | ||||
|                 ('minage', models.PositiveSmallIntegerField(help_text='Minimum number of days before the password can be changed', null=True, verbose_name='Minimum age', blank=True)), | ||||
|                 ('maxage', models.PositiveSmallIntegerField(help_text='Maximum number of days after which the password has to be changed', null=True, verbose_name='Maximum age', blank=True)), | ||||
|                 ('gracedays', models.PositiveSmallIntegerField(help_text='The number of days before the password is going to expire', null=True, verbose_name='Grace period', blank=True)), | ||||
|                 ('inactdays', models.PositiveSmallIntegerField(help_text='The number of days after the password has expired during which the password should still be accepted', null=True, verbose_name='Inactivity period', blank=True)), | ||||
|                 ('expiredays', models.PositiveSmallIntegerField(default=None, help_text='The date of expiration of the account, expressed as number of days since Jan 1, 1970', null=True, verbose_name='Account expiration date', blank=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)), | ||||
|                 ('user', models.OneToOneField( | ||||
|                     primary_key=True, serialize=False, to='osusers.User', | ||||
|                     verbose_name='Benutzer', on_delete=models.CASCADE)), | ||||
|                 ('passwd', models.CharField( | ||||
|                     max_length=128, verbose_name='Encrypted password')), | ||||
|                 ('changedays', models.PositiveSmallIntegerField( | ||||
|                     help_text='This is expressed in days since Jan 1, 1970', | ||||
|                     null=True, verbose_name='Date of last change', blank=True)), | ||||
|                 ('minage', models.PositiveSmallIntegerField( | ||||
|                     help_text='Minimum number of days before the password can ' | ||||
|                               'be changed', | ||||
|                     null=True, verbose_name='Minimum age', blank=True)), | ||||
|                 ('maxage', models.PositiveSmallIntegerField( | ||||
|                     help_text='Maximum number of days after which the ' | ||||
|                               'password has to be changed', | ||||
|                     null=True, verbose_name='Maximum age', blank=True)), | ||||
|                 ('gracedays', models.PositiveSmallIntegerField( | ||||
|                     help_text='The number of days before the password is ' | ||||
|                               'going to expire', | ||||
|                     null=True, verbose_name='Grace period', blank=True)), | ||||
|                 ('inactdays', models.PositiveSmallIntegerField( | ||||
|                     help_text='The number of days after the password has ' | ||||
|                               'expired during which the password should still ' | ||||
|                               'be accepted', | ||||
|                     null=True, verbose_name='Inactivity period', blank=True)), | ||||
|                 ('expiredays', models.PositiveSmallIntegerField( | ||||
|                     default=None, | ||||
|                     help_text='The date of expiration of the account, ' | ||||
|                               'expressed as number of days since Jan 1, 1970', | ||||
|                     null=True, verbose_name='Account expiration date', | ||||
|                     blank=True)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'Shadow password', | ||||
|  | @ -118,15 +180,21 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='UserTaskResult', | ||||
|             fields=[ | ||||
|                 ('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)), | ||||
|                 ('task_uuid', models.CharField(max_length=64, serialize=False, 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)), | ||||
|                 ('task_uuid', models.CharField( | ||||
|                     max_length=64, serialize=False, primary_key=True)), | ||||
|                 ('task_name', models.CharField(max_length=255, db_index=True)), | ||||
|                 ('is_finished', models.BooleanField(default=False)), | ||||
|                 ('is_success', models.BooleanField(default=False)), | ||||
|                 ('state', models.CharField(max_length=10)), | ||||
|                 ('result_body', models.TextField(blank=True)), | ||||
|                 ('user', models.ForeignKey(to='osusers.User')), | ||||
|                 ('user', models.ForeignKey( | ||||
|                     to='osusers.User', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|  | @ -136,23 +204,27 @@ class Migration(migrations.Migration): | |||
|         migrations.AddField( | ||||
|             model_name='user', | ||||
|             name='group', | ||||
|             field=models.ForeignKey(verbose_name='Group', to='osusers.Group'), | ||||
|             field=models.ForeignKey( | ||||
|                 verbose_name='Group', to='osusers.Group', | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='additionalgroup', | ||||
|             name='group', | ||||
|             field=models.ForeignKey(to='osusers.Group'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='osusers.Group', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='additionalgroup', | ||||
|             name='user', | ||||
|             field=models.ForeignKey(to='osusers.User'), | ||||
|             field=models.ForeignKey( | ||||
|                 to='osusers.User', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='additionalgroup', | ||||
|             unique_together=set([('user', 'group')]), | ||||
|             unique_together={('user', 'group')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ from django.conf import settings | |||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||||
|         ('osusers', '0002_auto_20141226_1456'), | ||||
|  | @ -16,7 +15,9 @@ class Migration(migrations.Migration): | |||
|         migrations.AddField( | ||||
|             model_name='user', | ||||
|             name='customer', | ||||
|             field=models.ForeignKey(default=1, to=settings.AUTH_USER_MODEL), | ||||
|             field=models.ForeignKey( | ||||
|                 default=1, to=settings.AUTH_USER_MODEL, | ||||
|                 on_delete=models.CASCADE), | ||||
|             preserve_default=False, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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 = [ | ||||
|         ('osusers', '0003_user_customer'), | ||||
|     ] | ||||
|  | @ -18,7 +17,9 @@ class Migration(migrations.Migration): | |||
|         migrations.AlterField( | ||||
|             model_name='shadow', | ||||
|             name='user', | ||||
|             field=models.OneToOneField(primary_key=True, serialize=False, to='osusers.User', verbose_name='User'), | ||||
|             field=models.OneToOneField( | ||||
|                 primary_key=True, serialize=False, to='osusers.User', | ||||
|                 verbose_name='User', on_delete=models.CASCADE), | ||||
|             preserve_default=True, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -1,13 +1,12 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| import model_utils.fields | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('osusers', '0004_auto_20150104_1751'), | ||||
|     ] | ||||
|  | @ -16,13 +15,25 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='SshPublicKey', | ||||
|             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)), | ||||
|                 ('algorithm', models.CharField(max_length=20, verbose_name='Algorithm')), | ||||
|                 ('data', models.TextField(help_text='Base64 encoded key bytes', verbose_name='Key bytes')), | ||||
|                 ('comment', models.TextField(verbose_name='Comment', blank=True)), | ||||
|                 ('user', models.ForeignKey(verbose_name='User', to='osusers.User')), | ||||
|                 ('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)), | ||||
|                 ('algorithm', models.CharField( | ||||
|                     max_length=20, verbose_name='Algorithm')), | ||||
|                 ('data', models.TextField( | ||||
|                     help_text='Base64 encoded key bytes', | ||||
|                     verbose_name='Key bytes')), | ||||
|                 ('comment', models.TextField( | ||||
|                     verbose_name='Comment', blank=True)), | ||||
|                 ('user', models.ForeignKey( | ||||
|                     verbose_name='User', to='osusers.User', | ||||
|                     on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'SSH public key', | ||||
|  | @ -32,6 +43,6 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='sshpublickey', | ||||
|             unique_together=set([('user', 'algorithm', 'data')]), | ||||
|             unique_together={('user', 'algorithm', 'data')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -198,11 +198,13 @@ class User(TimeStampedModel, models.Model): | |||
|         _('User name'), max_length=64, unique=True) | ||||
|     uid = models.PositiveSmallIntegerField( | ||||
|         _('User ID'), unique=True, primary_key=True) | ||||
|     group = models.ForeignKey(Group, verbose_name=_('Group')) | ||||
|     group = models.ForeignKey( | ||||
|         Group, verbose_name=_('Group'), on_delete=models.CASCADE) | ||||
|     gecos = models.CharField(_('Gecos field'), max_length=128, blank=True) | ||||
|     homedir = models.CharField(_('Home directory'), max_length=256) | ||||
|     shell = models.CharField(_('Login shell'), max_length=64) | ||||
|     customer = models.ForeignKey(settings.AUTH_USER_MODEL) | ||||
|     customer = models.ForeignKey( | ||||
|         settings.AUTH_USER_MODEL, on_delete=models.CASCADE) | ||||
| 
 | ||||
|     objects = UserManager() | ||||
| 
 | ||||
|  | @ -307,7 +309,9 @@ class Shadow(TimeStampedModel, models.Model): | |||
|     entry. | ||||
| 
 | ||||
|     """ | ||||
|     user = models.OneToOneField(User, primary_key=True, verbose_name=_('User')) | ||||
|     user = models.OneToOneField( | ||||
|         User, primary_key=True, verbose_name=_('User'), | ||||
|         on_delete=models.CASCADE) | ||||
|     passwd = models.CharField(_('Encrypted password'), max_length=128) | ||||
|     changedays = models.PositiveSmallIntegerField( | ||||
|         _('Date of last change'), | ||||
|  | @ -364,8 +368,8 @@ class AdditionalGroup(TimeStampedModel, models.Model): | |||
|     :py:class:`operating system user <osusers.models.User>`. | ||||
| 
 | ||||
|     """ | ||||
|     user = models.ForeignKey(User) | ||||
|     group = models.ForeignKey(Group) | ||||
|     user = models.ForeignKey(User, on_delete=models.CASCADE) | ||||
|     group = models.ForeignKey(Group, on_delete=models.CASCADE) | ||||
| 
 | ||||
|     class Meta: | ||||
|         unique_together = ('user', 'group') | ||||
|  | @ -498,7 +502,8 @@ class SshPublicKey(TimeStampedModel): | |||
|     system user <osusers.models.User>`. | ||||
| 
 | ||||
|     """ | ||||
|     user = models.ForeignKey(User, verbose_name=_('User')) | ||||
|     user = models.ForeignKey( | ||||
|         User, verbose_name=_('User'), on_delete=models.CASCADE) | ||||
|     algorithm = models.CharField(_('Algorithm'), max_length=20) | ||||
|     data = models.TextField(_('Key bytes'), | ||||
|                             help_text=_('Base64 encoded key bytes')) | ||||
|  |  | |||
|  | @ -4,8 +4,8 @@ This module defines the views for gnuviechadmin operating system user handling. | |||
| """ | ||||
| from __future__ import unicode_literals, absolute_import | ||||
| 
 | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.shortcuts import redirect | ||||
| from django.urls import reverse | ||||
| from django.views.generic import ( | ||||
|     CreateView, | ||||
|     DeleteView, | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ This module defines form classes for user database editing. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| 
 | ||||
| from crispy_forms.helper import FormHelper | ||||
|  |  | |||
|  | @ -1,13 +1,12 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import models, migrations | ||||
| import django.utils.timezone | ||||
| import model_utils.fields | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('osusers', '0004_auto_20150104_1751'), | ||||
|     ] | ||||
|  | @ -16,12 +15,22 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='DatabaseUser', | ||||
|             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(max_length=63, verbose_name='username')), | ||||
|                 ('db_type', models.PositiveSmallIntegerField(verbose_name='database type', choices=[(0, 'PostgreSQL'), (1, 'MySQL')])), | ||||
|                 ('osuser', models.ForeignKey(to='osusers.User')), | ||||
|                 ('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( | ||||
|                     max_length=63, verbose_name='username')), | ||||
|                 ('db_type', models.PositiveSmallIntegerField( | ||||
|                     verbose_name='database type', | ||||
|                     choices=[(0, 'PostgreSQL'), (1, 'MySQL')])), | ||||
|                 ('osuser', models.ForeignKey( | ||||
|                     to='osusers.User', on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'database user', | ||||
|  | @ -32,11 +41,20 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='UserDatabase', | ||||
|             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)), | ||||
|                 ('db_name', models.CharField(max_length=63, verbose_name='database name')), | ||||
|                 ('db_user', models.ForeignKey(verbose_name='database user', to='userdbs.DatabaseUser')), | ||||
|                 ('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)), | ||||
|                 ('db_name', models.CharField( | ||||
|                     max_length=63, verbose_name='database name')), | ||||
|                 ('db_user', models.ForeignKey( | ||||
|                     verbose_name='database user', to='userdbs.DatabaseUser', | ||||
|                     on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'user database', | ||||
|  | @ -46,10 +64,10 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='userdatabase', | ||||
|             unique_together=set([('db_name', 'db_user')]), | ||||
|             unique_together={('db_name', 'db_user')}, | ||||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='databaseuser', | ||||
|             unique_together=set([('name', 'db_type')]), | ||||
|             unique_together={('name', 'db_type')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -83,7 +83,7 @@ class DatabaseUserManager(models.Manager): | |||
| 
 | ||||
| @python_2_unicode_compatible | ||||
| class DatabaseUser(TimeStampedModel, models.Model): | ||||
|     osuser = models.ForeignKey(OsUser) | ||||
|     osuser = models.ForeignKey(OsUser, on_delete=models.CASCADE) | ||||
|     name = models.CharField( | ||||
|         _('username'), max_length=63) | ||||
|     db_type = models.PositiveSmallIntegerField( | ||||
|  | @ -203,7 +203,9 @@ class UserDatabase(TimeStampedModel, models.Model): | |||
|     # MySQL limits to 64, PostgreSQL to 63 characters | ||||
|     db_name = models.CharField( | ||||
|         _('database name'), max_length=63) | ||||
|     db_user = models.ForeignKey(DatabaseUser, verbose_name=_('database user')) | ||||
|     db_user = models.ForeignKey( | ||||
|         DatabaseUser, verbose_name=_('database user'), | ||||
|         on_delete=models.CASCADE) | ||||
| 
 | ||||
|     objects = UserDatabaseManager() | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ This module defines form classes for website editing. | |||
| from __future__ import absolute_import, unicode_literals | ||||
| 
 | ||||
| from django import forms | ||||
| from django.core.urlresolvers import reverse | ||||
| from django.urls import reverse | ||||
| from django.utils.translation import ugettext as _ | ||||
| 
 | ||||
| from crispy_forms.bootstrap import AppendedText | ||||
|  |  | |||
|  | @ -1,11 +1,10 @@ | |||
| # -*- 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 = [ | ||||
|         ('osusers', '0004_auto_20150104_1751'), | ||||
|         ('domains', '0002_auto_20150124_1909'), | ||||
|  | @ -15,11 +14,19 @@ class Migration(migrations.Migration): | |||
|         migrations.CreateModel( | ||||
|             name='Website', | ||||
|             fields=[ | ||||
|                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||||
|                 ('subdomain', models.CharField(max_length=64, verbose_name='sub domain')), | ||||
|                 ('wildcard', models.BooleanField(default=False, verbose_name='wildcard')), | ||||
|                 ('domain', models.ForeignKey(verbose_name='domain', to='domains.HostingDomain')), | ||||
|                 ('osuser', models.ForeignKey(verbose_name='operating system user', to='osusers.User')), | ||||
|                 ('id', models.AutoField( | ||||
|                     verbose_name='ID', serialize=False, auto_created=True, | ||||
|                     primary_key=True)), | ||||
|                 ('subdomain', models.CharField( | ||||
|                     max_length=64, verbose_name='sub domain')), | ||||
|                 ('wildcard', models.BooleanField( | ||||
|                     default=False, verbose_name='wildcard')), | ||||
|                 ('domain', models.ForeignKey( | ||||
|                     verbose_name='domain', to='domains.HostingDomain', | ||||
|                     on_delete=models.CASCADE)), | ||||
|                 ('osuser', models.ForeignKey( | ||||
|                     verbose_name='operating system user', to='osusers.User', | ||||
|                     on_delete=models.CASCADE)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'verbose_name': 'website', | ||||
|  | @ -29,6 +36,6 @@ class Migration(migrations.Migration): | |||
|         ), | ||||
|         migrations.AlterUniqueTogether( | ||||
|             name='website', | ||||
|             unique_together=set([('domain', 'subdomain')]), | ||||
|             unique_together={('domain', 'subdomain')}, | ||||
|         ), | ||||
|     ] | ||||
|  |  | |||
|  | @ -34,9 +34,10 @@ class Website(models.Model): | |||
|     subdomain = models.CharField( | ||||
|         _('sub domain'), max_length=64) | ||||
|     osuser = models.ForeignKey( | ||||
|         OsUser, verbose_name=_('operating system user')) | ||||
|         OsUser, verbose_name=_('operating system user'), | ||||
|         on_delete=models.CASCADE) | ||||
|     domain = models.ForeignKey( | ||||
|         HostingDomain, verbose_name=_('domain')) | ||||
|         HostingDomain, models.CASCADE, verbose_name=_('domain')) | ||||
|     wildcard = models.BooleanField(_('wildcard'), default=False) | ||||
| 
 | ||||
|     class Meta: | ||||
|  |  | |||
|  | @ -1,39 +0,0 @@ | |||
| #!/bin/sh - | ||||
| 
 | ||||
| apt-get update | ||||
| apt-get install -y python-cryptography | ||||
| 
 | ||||
| # We just download the bootstrap script by default and execute that. | ||||
| if [ -x /usr/bin/fetch ]; then | ||||
|     /usr/bin/fetch -o - https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" | ||||
| elif [ -x /usr/bin/curl ]; then | ||||
|     /usr/bin/curl -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" | ||||
| else | ||||
|     python \ | ||||
|         -c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh").read()' \ | ||||
|         | sh -s -- "$@" | ||||
| fi | ||||
| 
 | ||||
| cat >/etc/salt/minion <<EOF | ||||
| file_client: local | ||||
| 
 | ||||
| file_roots: | ||||
|   base: | ||||
|     - /srv/salt/ | ||||
| 
 | ||||
| pillar_roots: | ||||
|   base: | ||||
|     - /srv/pillar | ||||
| 
 | ||||
| log_file: file:///dev/log | ||||
| EOF | ||||
| 
 | ||||
| umask 077 | ||||
| cat >/etc/salt/grains <<EOF | ||||
| roles: | ||||
|   - redis-server | ||||
|   - rabbitmq-server | ||||
|   - gnuviechadmin.database | ||||
|   - gnuviechadmin.queues | ||||
|   - gnuviechadmin.webinterface | ||||
| EOF | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue