| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- from django.apps import AppConfig
- from constance.apps import ConstanceConfig
- from post_office.apps import PostOfficeConfig
- from django.template.loader import render_to_string, get_template
- from django.utils.html import strip_tags
- class ConstanceBase(ConstanceConfig):
- verbose_name = "Configuration"
- class project_base(AppConfig):
- name = 'project_base'
- def ready(self):
- from django.contrib.auth.models import User
- print("ready")
- user = User.objects.update_or_create(username='admin',
- defaults={
- 'email':'admin@server.com',
- 'password':'admin_pass',
- 'is_superuser': 'True',
- 'is_staff': 'True' }
- )
- u = User.objects.get(username='admin')
- u.set_password('admin_pass')
- u.save()
- class PostOfficeBase(PostOfficeConfig):
- def ready(self):
- 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()
- #
- #
- # 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}
- # )
|