forked from CGM_Public/pretix_original
add migration
This commit is contained in:
@@ -928,7 +928,8 @@ Creating orders
|
|||||||
during order generation and is not respected automatically when the order changes later.)
|
during order generation and is not respected automatically when the order changes later.)
|
||||||
|
|
||||||
* ``force`` (optional). If set to ``true``, quotas will be ignored.
|
* ``force`` (optional). If set to ``true``, quotas will be ignored.
|
||||||
* ``send_mail`` (optional). If set to ``true``, the same emails will be sent as for a regular order. Defaults to
|
* ``send_mail`` (optional). If set to ``true``, the same emails will be sent as for a regular order, regardless of
|
||||||
|
whether these emails are enabled for certain sales channels. Defaults to
|
||||||
``false``.
|
``false``.
|
||||||
|
|
||||||
If you want to use add-on products, you need to set the ``positionid`` fields of all positions manually
|
If you want to use add-on products, you need to set the ``positionid`` fields of all positions manually
|
||||||
|
|||||||
39
src/pretix/base/migrations/0158_mails_by_sales_channel.py
Normal file
39
src/pretix/base/migrations/0158_mails_by_sales_channel.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Generated by Django 3.0.8 on 2020-07-24 09:05
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
from pretix.base.channels import get_all_sales_channels
|
||||||
|
|
||||||
|
def set_sales_channels(apps, schema_editor):
|
||||||
|
# We now allow restricting some mails to certain sales channels
|
||||||
|
# The default is changing from all channels to "web" only
|
||||||
|
# Therefore, for existing events, we enable all sales channels
|
||||||
|
Event_SettingsStore = apps.get_model('pretixbase', 'Event_SettingsStore')
|
||||||
|
Event = apps.get_model('pretixbase', 'Event')
|
||||||
|
all_sales_channels = "[" + ", ".join('"' + sc + '"' for sc in get_all_sales_channels()) + "]"
|
||||||
|
batch_size = 1000
|
||||||
|
Event_SettingsStore.objects.bulk_create([
|
||||||
|
Event_SettingsStore(
|
||||||
|
object=event,
|
||||||
|
key="mail_sales_channel_placed_paid",
|
||||||
|
value=all_sales_channels)
|
||||||
|
for event in Event.objects.all()
|
||||||
|
], batch_size=batch_size)
|
||||||
|
Event_SettingsStore.objects.bulk_create([
|
||||||
|
Event_SettingsStore(
|
||||||
|
object=event,
|
||||||
|
key="mail_sales_channel_ticket_reminder",
|
||||||
|
value=all_sales_channels)
|
||||||
|
for event in Event.objects.all()
|
||||||
|
], batch_size=batch_size)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0157_auto_20200712_0932'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(set_sales_channels, migrations.RunPython.noop),
|
||||||
|
]
|
||||||
@@ -750,6 +750,10 @@ def multimail_validate(val):
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def contains_web_channel_validate(val):
|
||||||
|
if "web" not in val:
|
||||||
|
raise ValidationError(_("The web channel must be selected to receive these emails."))
|
||||||
|
|
||||||
class MailSettingsForm(SettingsForm):
|
class MailSettingsForm(SettingsForm):
|
||||||
auto_fields = [
|
auto_fields = [
|
||||||
'mail_prefix',
|
'mail_prefix',
|
||||||
@@ -759,23 +763,23 @@ class MailSettingsForm(SettingsForm):
|
|||||||
]
|
]
|
||||||
|
|
||||||
mail_sales_channel_placed_paid = forms.MultipleChoiceField(
|
mail_sales_channel_placed_paid = forms.MultipleChoiceField(
|
||||||
choices=[(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
choices=lambda: [(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
||||||
label=_('Sales Channels for Checkout Emails'),
|
label=_('Sales Channels for Checkout Emails'),
|
||||||
help_text=_('Restrict Order placed and paid emails to orders from certain sales channels.'),
|
help_text=_('The order placed and paid emails will only be send to orders from these sales channels. The online shop must be enabled.'),
|
||||||
widget=forms.CheckboxSelectMultiple(
|
widget=forms.CheckboxSelectMultiple(
|
||||||
attrs={'class': 'scrolling-multiple-choice'}
|
attrs={'class': 'scrolling-multiple-choice'}
|
||||||
),
|
),
|
||||||
required=False,
|
validators=[contains_web_channel_validate],
|
||||||
)
|
)
|
||||||
|
|
||||||
mail_sales_channel_ticket_reminder = forms.MultipleChoiceField(
|
mail_sales_channel_ticket_reminder = forms.MultipleChoiceField(
|
||||||
choices=[(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
choices=lambda: [(ident, sc.verbose_name) for ident, sc in get_all_sales_channels().items()],
|
||||||
label=_('Sales Channels for Ticket Emails'),
|
label=_('Sales Channels'),
|
||||||
help_text=_('Restrict ticket reminder emails to orders from certain sales channels.'),
|
help_text=_('This email will only be send to orders from these sales channels. The online shop must be enabled.'),
|
||||||
widget=forms.CheckboxSelectMultiple(
|
widget=forms.CheckboxSelectMultiple(
|
||||||
attrs={'class': 'scrolling-multiple-choice'}
|
attrs={'class': 'scrolling-multiple-choice'}
|
||||||
),
|
),
|
||||||
required=False,
|
validators=[contains_web_channel_validate],
|
||||||
)
|
)
|
||||||
|
|
||||||
mail_bcc = forms.CharField(
|
mail_bcc = forms.CharField(
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
{% bootstrap_field form.mail_bcc layout="control" %}
|
{% bootstrap_field form.mail_bcc layout="control" %}
|
||||||
{% bootstrap_field form.mail_attach_ical layout="control" %}
|
{% bootstrap_field form.mail_attach_ical layout="control" %}
|
||||||
{% bootstrap_field form.mail_sales_channel_placed_paid layout="control" %}
|
{% bootstrap_field form.mail_sales_channel_placed_paid layout="control" %}
|
||||||
{% bootstrap_field form.mail_sales_channel_ticket_reminder layout="control" %}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{% trans "E-mail design" %}</legend>
|
<legend>{% trans "E-mail design" %}</legend>
|
||||||
@@ -72,7 +71,7 @@
|
|||||||
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="custom_mail" title=title_order_custom_mail items="mail_text_order_custom_mail" %}
|
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="custom_mail" title=title_order_custom_mail items="mail_text_order_custom_mail" %}
|
||||||
|
|
||||||
{% blocktrans asvar title_download_tickets_reminder %}Reminder to download tickets{% endblocktrans %}
|
{% blocktrans asvar title_download_tickets_reminder %}Reminder to download tickets{% endblocktrans %}
|
||||||
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="ticket_reminder" title=title_download_tickets_reminder items="mail_days_download_reminder,mail_text_download_reminder,mail_send_download_reminder_attendee,mail_text_download_reminder_attendee" exclude="mail_days_download_reminder,mail_send_download_reminder_attendee" %}
|
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="ticket_reminder" title=title_download_tickets_reminder items="mail_days_download_reminder,mail_text_download_reminder,mail_send_download_reminder_attendee,mail_text_download_reminder_attendee,mail_sales_channel_ticket_reminder" exclude="mail_days_download_reminder,mail_send_download_reminder_attendee,mail_sales_channel_ticket_reminder" %}
|
||||||
|
|
||||||
{% blocktrans asvar title_require_approval %}Order approval process{% endblocktrans %}
|
{% blocktrans asvar title_require_approval %}Order approval process{% endblocktrans %}
|
||||||
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="ticket_reminder" title=title_require_approval items="mail_text_order_placed_require_approval,mail_text_order_approved,mail_text_order_denied" %}
|
{% include "pretixcontrol/event/mail_settings_fragment.html" with pid="ticket_reminder" title=title_require_approval items="mail_text_order_placed_require_approval,mail_text_order_approved,mail_text_order_denied" %}
|
||||||
|
|||||||
Reference in New Issue
Block a user