2015-04-08 14:41:09 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django . db import models , migrations
import orchestra . core . validators
from django . conf import settings
class Migration ( migrations . Migration ) :
dependencies = [
( ' webapps ' , ' 0001_initial ' ) ,
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 ' ) ,
]
operations = [
migrations . CreateModel (
name = ' Content ' ,
fields = [
( ' id ' , models . AutoField ( verbose_name = ' ID ' , auto_created = True , serialize = False , primary_key = True ) ) ,
2015-04-29 13:55:22 +00:00
( ' path ' , models . CharField ( verbose_name = ' path ' , validators = [ orchestra . core . validators . validate_url_path ] , blank = True , max_length = 256 ) ) ,
( ' webapp ' , models . ForeignKey ( verbose_name = ' web application ' , to = ' webapps.WebApp ' ) ) ,
2015-04-08 14:41:09 +00:00
] ,
) ,
migrations . CreateModel (
name = ' Website ' ,
fields = [
( ' id ' , models . AutoField ( verbose_name = ' ID ' , auto_created = True , serialize = False , primary_key = True ) ) ,
2015-04-29 13:55:22 +00:00
( ' name ' , models . CharField ( verbose_name = ' name ' , validators = [ orchestra . core . validators . validate_name ] , max_length = 128 ) ) ,
( ' 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 13:55:22 +00:00
( ' account ' , models . ForeignKey ( verbose_name = ' Account ' , related_name = ' websites ' , to = settings . AUTH_USER_MODEL ) ) ,
2015-04-08 14:41:09 +00:00
( ' contents ' , models . ManyToManyField ( to = ' webapps.WebApp ' , through = ' websites.Content ' ) ) ,
2015-04-29 13:55:22 +00:00
( ' domains ' , models . ManyToManyField ( verbose_name = ' domains ' , to = ' domains.Domain ' , related_name = ' websites ' ) ) ,
2015-04-08 14:41:09 +00:00
] ,
) ,
migrations . CreateModel (
name = ' WebsiteDirective ' ,
fields = [
( ' id ' , models . AutoField ( verbose_name = ' ID ' , auto_created = True , serialize = False , primary_key = True ) ) ,
2015-04-29 13:55:22 +00:00
( ' name ' , models . CharField ( verbose_name = ' name ' , choices = [ ( None , ' ------- ' ) , ( ' ModSecurity ' , [ ( ' sec-rule-remove ' , ' SecRuleRemoveById ' ) , ( ' sec-engine ' , ' SecRuleEngine Off ' ) ] ) , ( ' SSL ' , [ ( ' ssl-ca ' , ' SSL CA ' ) , ( ' ssl-cert ' , ' SSL cert ' ) , ( ' ssl-key ' , ' SSL key ' ) ] ) , ( ' HTTPD ' , [ ( ' redirect ' , ' Redirection ' ) , ( ' proxy ' , ' Proxy ' ) , ( ' error-document ' , ' ErrorDocumentRoot ' ) ] ) , ( ' 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 13:55:22 +00:00
( ' website ' , models . ForeignKey ( verbose_name = ' web site ' , related_name = ' directives ' , 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 ' ) ] ) ,
) ,
]