|
@@ -1,6 +1,7 @@
|
|
|
from django.apps import AppConfig
|
|
from django.apps import AppConfig
|
|
|
from constance.apps import ConstanceConfig
|
|
from constance.apps import ConstanceConfig
|
|
|
from post_office.apps import PostOfficeConfig
|
|
from post_office.apps import PostOfficeConfig
|
|
|
|
|
+from django.contrib.auth.apps import AuthConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
from django.db import connection
|
|
from django.db import connection
|
|
@@ -18,6 +19,7 @@ def create_admin(sender=None, **kwargs):
|
|
|
|
|
|
|
|
from django.contrib.auth.models import User
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
|
|
|
|
+ print("user post migrations")
|
|
|
user = User.objects.update_or_create(username='admin',
|
|
user = User.objects.update_or_create(username='admin',
|
|
|
defaults={
|
|
defaults={
|
|
|
'email':'admin@server.com',
|
|
'email':'admin@server.com',
|
|
@@ -32,10 +34,17 @@ def create_admin(sender=None, **kwargs):
|
|
|
class project_base(AppConfig):
|
|
class project_base(AppConfig):
|
|
|
name = 'project_base'
|
|
name = 'project_base'
|
|
|
def ready(self):
|
|
def ready(self):
|
|
|
|
|
+ print("base ready")
|
|
|
super().ready()
|
|
super().ready()
|
|
|
post_migrate.connect(create_admin, sender=self)
|
|
post_migrate.connect(create_admin, sender=self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+class AuthConfigBase(AuthConfig):
|
|
|
|
|
+
|
|
|
|
|
+ def ready(self):
|
|
|
|
|
+ print("base ready")
|
|
|
|
|
+ super().ready()
|
|
|
|
|
+ post_migrate.connect(create_admin, sender=self)
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_emails(sender=None, **kwargs):
|
|
def create_emails(sender=None, **kwargs):
|
|
@@ -52,50 +61,9 @@ def create_emails(sender=None, **kwargs):
|
|
|
)
|
|
)
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
-class PostOfficeBase(PostOfficeConfig):
|
|
|
|
|
|
|
|
|
|
|
|
+class PostOfficeBase(PostOfficeConfig):
|
|
|
|
|
|
|
|
def ready(self):
|
|
def ready(self):
|
|
|
-
|
|
|
|
|
- # def db_table_exists(table_name):
|
|
|
|
|
- # return table_name in connection.introspection.table_names()
|
|
|
|
|
- #
|
|
|
|
|
- # if db_table_exists( 'post_office_emailtemplate' ):
|
|
|
|
|
- #
|
|
|
|
|
- # from post_office.models import EmailTemplate
|
|
|
|
|
- # EmailTemplate.objects.update_or_create(
|
|
|
|
|
- # name='generic',
|
|
|
|
|
- # defaults={
|
|
|
|
|
- # 'subject' : 'Neue Nachricht von gemeinschaffen.at',
|
|
|
|
|
- # 'description' : 'Generic template',
|
|
|
|
|
- # 'html_content' : "content html",
|
|
|
|
|
- # 'content' : "content"}
|
|
|
|
|
- # )
|
|
|
|
|
-
|
|
|
|
|
super().ready()
|
|
super().ready()
|
|
|
-
|
|
|
|
|
post_migrate.connect(create_emails, sender=self)
|
|
post_migrate.connect(create_emails, sender=self)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-#
|
|
|
|
|
-#
|
|
|
|
|
-# def db_table_exists(table_name):
|
|
|
|
|
-# return table_name in connection.introspection.table_names()
|
|
|
|
|
-#
|
|
|
|
|
-# if db_table_exists( 'post_office_emailtemplate' ):
|
|
|
|
|
-#
|
|
|
|
|
-#
|
|
|
|
|
-# tFile = get_template('streets/email/generic.html')
|
|
|
|
|
-# with open( str(tFile.template.origin), 'r') as file:
|
|
|
|
|
-# tContentHTML = file.read()
|
|
|
|
|
-# tContent = strip_tags(tContentHTML)
|
|
|
|
|
-#
|
|
|
|
|
-# EmailTemplate.objects.update_or_create(
|
|
|
|
|
-# name='generic',
|
|
|
|
|
-# defaults={
|
|
|
|
|
-# 'subject' : _('Message from pop-up.wien'),
|
|
|
|
|
-# 'description' : 'Generic template',
|
|
|
|
|
-# 'html_content' : tContentHTML,
|
|
|
|
|
-# 'content' : tContent}
|
|
|
|
|
-# )
|
|
|