forked from CGM_Public/pretix_original
Allow to set multiple confirm texts (#1735)
This commit is contained in:
27
src/pretix/base/migrations/0160_multiple_confirm_texts.py
Normal file
27
src/pretix/base/migrations/0160_multiple_confirm_texts.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2020-07-31 10:05
|
||||
|
||||
import json
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def migrate_confirm_text(apps, schema_editor):
|
||||
# We now allow creating multiple confirm texts so we migrate the setting for that
|
||||
# from `confirm_text` to `confirm_texts`
|
||||
Event_SettingsStore = apps.get_model('pretixbase', 'Event_SettingsStore')
|
||||
for store in Event_SettingsStore.objects.filter(key="confirm_text"):
|
||||
values = json.dumps([json.loads(store.value)]) # convert single value to one-element list
|
||||
store.key = "confirm_texts"
|
||||
store.value = values
|
||||
store.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pretixbase', '0159_mails_by_sales_channel'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_confirm_text, migrations.RunPython.noop),
|
||||
]
|
||||
Reference in New Issue
Block a user