From 78cfc0eb84fb89f3d873deefe4ae028f08503989 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 25 Aug 2023 10:39:46 +0200 Subject: [PATCH] add action image and link --- organization/core/models.py | 2 +- .../migrations/0060_auto_20230825_1039.py | 106 ++++++++++++++++++ organization/pages/translation.py | 2 +- 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 organization/pages/migrations/0060_auto_20230825_1039.py diff --git a/organization/core/models.py b/organization/core/models.py index 8b975687..becb4bbb 100644 --- a/organization/core/models.py +++ b/organization/core/models.py @@ -683,7 +683,7 @@ class Meta: abstract = True -class Action(Named): +class Action(Image, Link): """ Abstract model that provides an Action object. """ diff --git a/organization/pages/migrations/0060_auto_20230825_1039.py b/organization/pages/migrations/0060_auto_20230825_1039.py new file mode 100644 index 00000000..3db2f3d6 --- /dev/null +++ b/organization/pages/migrations/0060_auto_20230825_1039.py @@ -0,0 +1,106 @@ +# Generated by Django 3.2.19 on 2023-08-25 08:39 + +from django.db import migrations, models +import django.db.models.deletion +import mezzanine.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization_core', '0014_metacategory_icon_id'), + ('organization_pages', '0059_pageaction_action'), + ] + + operations = [ + migrations.AlterModelOptions( + name='pageaction', + options={'ordering': ('_order',), 'verbose_name': 'action', 'verbose_name_plural': 'action'}, + ), + migrations.AddField( + model_name='pageaction', + name='_order', + field=mezzanine.core.fields.OrderField(null=True, verbose_name='Order'), + ), + migrations.AddField( + model_name='pageaction', + name='action_en', + field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='action'), + ), + migrations.AddField( + model_name='pageaction', + name='action_fr', + field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='action'), + ), + migrations.AddField( + model_name='pageaction', + name='credits', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='credits'), + ), + migrations.AddField( + model_name='pageaction', + name='credits_en', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='credits'), + ), + migrations.AddField( + model_name='pageaction', + name='credits_fr', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='credits'), + ), + migrations.AddField( + model_name='pageaction', + name='crop_data', + field=models.CharField(blank=True, default='', max_length=1024, null=True), + ), + migrations.AddField( + model_name='pageaction', + name='file', + field=mezzanine.core.fields.FileField(blank=True, max_length=1024, null=True, verbose_name='Image'), + ), + migrations.AddField( + model_name='pageaction', + name='link_type', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='organization_core.linktype', verbose_name='link type'), + ), + migrations.AddField( + model_name='pageaction', + name='title', + field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), + ), + migrations.AddField( + model_name='pageaction', + name='title_en', + field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), + ), + migrations.AddField( + model_name='pageaction', + name='title_fr', + field=models.CharField(blank=True, max_length=1024, null=True, verbose_name='title'), + ), + migrations.AddField( + model_name='pageaction', + name='type', + field=models.CharField(blank=True, choices=[('logo', 'logo'), ('logo_white', 'logo white'), ('logo_black', 'logo black'), ('logo_header', 'logo header'), ('logo_back', 'logo back'), ('logo_footer', 'logo footer'), ('slider', 'slider'), ('card', 'card'), ('page_slider', 'page - slider'), ('page_featured', 'page - featured'), ('hero', 'hero'), ('banner', 'banner')], max_length=64, null=True, verbose_name='type'), + ), + migrations.AddField( + model_name='pageaction', + name='url', + field=models.URLField(blank=True, max_length=512, verbose_name='URL'), + ), + migrations.AlterOrderWithRespectTo( + name='pageaction', + order_with_respect_to=None, + ), + migrations.RemoveField( + model_name='pageaction', + name='name', + ), + migrations.RemoveField( + model_name='pageaction', + name='name_en', + ), + migrations.RemoveField( + model_name='pageaction', + name='name_fr', + ), + ] diff --git a/organization/pages/translation.py b/organization/pages/translation.py index 9c8c5c64..88bfc8d4 100644 --- a/organization/pages/translation.py +++ b/organization/pages/translation.py @@ -121,7 +121,7 @@ class PageRelatedTitleTranslationOptions(TranslationOptions): @register(PageAction) class PageActionTranslationOptions(TranslationOptions): - fields = ('name', 'description') + fields = ('title', 'description', 'action') @register(HomeImage)