From cf84bf9cbfb564ea5b5fb93e006f9c7988e46352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=C5=A1ek=20Chalupn=C3=AD=C4=8Dek?= Date: Wed, 19 Jul 2023 19:24:57 +0200 Subject: [PATCH 1/4] avoid generating migrations based on settings --- djangocms_alias/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/djangocms_alias/models.py b/djangocms_alias/models.py index 861f0ec0..ce7ebdbe 100644 --- a/djangocms_alias/models.py +++ b/djangocms_alias/models.py @@ -268,7 +268,6 @@ class AliasContent(models.Model): placeholder_slotname = 'content' language = models.CharField( max_length=10, - choices=settings.LANGUAGES, default=get_language, ) @@ -278,6 +277,10 @@ class Meta: verbose_name = _('alias content') verbose_name_plural = _('alias contents') + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._meta.get_field('language').choices = settings.LANGUAGES + def __str__(self): return f'{self.name} ({self.language})' From 9f142441bb82845adea0ff03c6989033e520e95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=C5=A1ek=20Chalupn=C3=AD=C4=8Dek?= Date: Wed, 26 Jul 2023 15:00:36 +0200 Subject: [PATCH 2/4] fixing flake8 --- djangocms_alias/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_alias/models.py b/djangocms_alias/models.py index ce7ebdbe..1bd9793c 100644 --- a/djangocms_alias/models.py +++ b/djangocms_alias/models.py @@ -280,7 +280,7 @@ class Meta: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._meta.get_field('language').choices = settings.LANGUAGES - + def __str__(self): return f'{self.name} ({self.language})' From c75378cbdea7e15515d00665b834913b4d65e612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=C5=A1ek=20Chalupn=C3=AD=C4=8Dek?= Date: Wed, 26 Jul 2023 15:50:16 +0200 Subject: [PATCH 3/4] added migration reflecting model changes --- .../0003_alter_aliascontent_language.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 djangocms_alias/migrations/0003_alter_aliascontent_language.py diff --git a/djangocms_alias/migrations/0003_alter_aliascontent_language.py b/djangocms_alias/migrations/0003_alter_aliascontent_language.py new file mode 100644 index 00000000..b3c9ba47 --- /dev/null +++ b/djangocms_alias/migrations/0003_alter_aliascontent_language.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.20 on 2023-07-26 13:43 + +from django.db import migrations, models +import django.utils.translation + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangocms_alias', '0002_auto_20200723_1424'), + ] + + operations = [ + migrations.AlterField( + model_name='aliascontent', + name='language', + field=models.CharField(default=django.utils.translation.get_language, max_length=10), + ), + ] From 12c6e828b452139b061950184229b2d1b8630ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=C5=A1ek=20Chalupn=C3=AD=C4=8Dek?= Date: Wed, 26 Jul 2023 16:02:13 +0200 Subject: [PATCH 4/4] preparation for merge with other incoming migrations --- ...scontent_language.py => 0004_alter_aliascontent_language.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename djangocms_alias/migrations/{0003_alter_aliascontent_language.py => 0004_alter_aliascontent_language.py} (88%) diff --git a/djangocms_alias/migrations/0003_alter_aliascontent_language.py b/djangocms_alias/migrations/0004_alter_aliascontent_language.py similarity index 88% rename from djangocms_alias/migrations/0003_alter_aliascontent_language.py rename to djangocms_alias/migrations/0004_alter_aliascontent_language.py index b3c9ba47..122efd72 100644 --- a/djangocms_alias/migrations/0003_alter_aliascontent_language.py +++ b/djangocms_alias/migrations/0004_alter_aliascontent_language.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('djangocms_alias', '0002_auto_20200723_1424'), + ('djangocms_alias', '0003_auto_20230725_1547'), ] operations = [