2015-04-08 14:41:09 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django . db import models , migrations
from django . conf import settings
2015-04-29 14:32:38 +00:00
import orchestra . core . validators
2015-04-08 14:41:09 +00:00
class Migration ( migrations . Migration ) :
dependencies = [
2015-04-29 13:55:22 +00:00
migrations . swappable_dependency ( settings . AUTH_USER_MODEL ) ,
2015-04-08 14:41:09 +00:00
( ' domains ' , ' 0001_initial ' ) ,
2015-04-29 14:32:38 +00:00
( ' webapps ' , ' 0001_initial ' ) ,
2015-04-08 14:41:09 +00:00
]
operations = [
migrations . CreateModel (
name = ' Content ' ,
fields = [
2015-04-29 14:32:38 +00:00
( ' id ' , models . AutoField ( verbose_name = ' ID ' , primary_key = True , auto_created = True , serialize = False ) ) ,
( ' path ' , models . CharField ( validators = [ orchestra . core . validators . validate_url_path ] , verbose_name = ' path ' , max_length = 256 , blank = True ) ) ,
2015-04-29 13:55:22 +00:00
( ' webapp ' , models . ForeignKey ( verbose_name = ' web application ' , to = ' webapps.WebApp ' ) ) ,
2015-04-08 14:41:09 +00:00
] ,
) ,
migrations . CreateModel (
name = ' Website ' ,
fields = [
2015-04-29 14:32:38 +00:00
( ' id ' , models . AutoField ( verbose_name = ' ID ' , primary_key = True , auto_created = True , serialize = False ) ) ,
( ' name ' , models . CharField ( validators = [ orchestra . core . validators . validate_name ] , verbose_name = ' name ' , max_length = 128 ) ) ,
2015-04-29 13:55:22 +00:00
( ' protocol ' , models . CharField ( verbose_name = ' protocol ' , default = ' http ' , choices = [ ( ' http ' , ' HTTP ' ) , ( ' https ' , ' HTTPS ' ) , ( ' http/https ' , ' HTTP and HTTPS ' ) , ( ' https-only ' , ' HTTPS only ' ) ] , help_text = ' Select the protocol(s) for this website<br><tt>HTTPS only</tt> performs a redirection from <tt>http</tt> to <tt>https</tt>. ' , max_length = 16 ) ) ,
2015-04-08 14:41:09 +00:00
( ' is_active ' , models . BooleanField ( verbose_name = ' active ' , default = True ) ) ,
2015-04-29 14:32:38 +00:00
( ' account ' , models . ForeignKey ( related_name = ' websites ' , verbose_name = ' Account ' , to = settings . AUTH_USER_MODEL ) ) ,
( ' contents ' , models . ManyToManyField ( through = ' websites.Content ' , to = ' webapps.WebApp ' ) ) ,
( ' domains ' , models . ManyToManyField ( verbose_name = ' domains ' , related_name = ' websites ' , to = ' domains.Domain ' ) ) ,
2015-04-08 14:41:09 +00:00
] ,
) ,
migrations . CreateModel (
name = ' WebsiteDirective ' ,
fields = [
2015-04-29 14:32:38 +00:00
( ' id ' , models . AutoField ( verbose_name = ' ID ' , primary_key = True , auto_created = True , serialize = False ) ) ,
( ' name ' , models . CharField ( verbose_name = ' name ' , choices = [ ( None , ' ------- ' ) , ( ' SSL ' , [ ( ' ssl-ca ' , ' SSL CA ' ) , ( ' ssl-cert ' , ' SSL cert ' ) , ( ' ssl-key ' , ' SSL key ' ) ] ) , ( ' HTTPD ' , [ ( ' redirect ' , ' Redirection ' ) , ( ' proxy ' , ' Proxy ' ) , ( ' error-document ' , ' ErrorDocumentRoot ' ) ] ) , ( ' ModSecurity ' , [ ( ' sec-rule-remove ' , ' SecRuleRemoveById ' ) , ( ' sec-engine ' , ' SecRuleEngine Off ' ) ] ) , ( ' SaaS ' , [ ( ' wordpress-saas ' , ' WordPress SaaS ' ) , ( ' dokuwiki-saas ' , ' DokuWiki SaaS ' ) , ( ' drupal-saas ' , ' Drupdal SaaS ' ) ] ) ] , max_length = 128 ) ) ,
2015-04-08 14:41:09 +00:00
( ' value ' , models . CharField ( verbose_name = ' value ' , max_length = 256 ) ) ,
2015-04-29 14:32:38 +00:00
( ' website ' , models . ForeignKey ( related_name = ' directives ' , verbose_name = ' web site ' , to = ' websites.Website ' ) ) ,
2015-04-08 14:41:09 +00:00
] ,
) ,
migrations . AddField (
model_name = ' content ' ,
name = ' website ' ,
2015-04-29 13:55:22 +00:00
field = models . ForeignKey ( verbose_name = ' web site ' , to = ' websites.Website ' ) ,
2015-04-08 14:41:09 +00:00
) ,
migrations . AlterUniqueTogether (
name = ' website ' ,
unique_together = set ( [ ( ' name ' , ' account ' ) ] ) ,
) ,
migrations . AlterUniqueTogether (
name = ' content ' ,
unique_together = set ( [ ( ' website ' , ' path ' ) ] ) ,
) ,
]