blob: cf7723de192b7205fa0839fe59a7c40fa6851940 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# Generated by Django 2.2.24 on 2024-09-26 11:53
from django.conf import settings
from django.db import migrations
from django.template import loader
from django.utils import translation
from ishtar_common.utils_migrations import HOMEPAGE_TITLE
def default_welcome(apps, __):
IshtarSiteProfile = apps.get_model("ishtar_common", "IshtarSiteProfile")
old_language = translation.get_language()
translation.activate(settings.LANGUAGE_CODE)
homepage = loader.render_to_string("ishtar/homepage_default.html")
title = str(HOMEPAGE_TITLE)
translation.activate(old_language)
for profile in IshtarSiteProfile.objects.all():
changed = False
if not profile.homepage:
changed = True
profile.homepage = homepage
if not profile.homepage_title:
changed = True
profile.homepage_title = title
if changed:
profile.save()
class Migration(migrations.Migration):
dependencies = [
('ishtar_common', '0250_profile_homepage'),
]
operations = [
migrations.RunPython(default_welcome)
]
|