Example #1
0
    def _mail(self):
        # Mail the code to self.email
        # return the verification code
        # code will be stored in the session by the view
        locale = 'en'
        with language(locale):
            email_content = LazyI18nString.from_gettext(
                ugettext_noop("""Hello,

Here's your verification code. Use it to validate your email and continue the checkout process.

{code}

Best regards,
Your {event} team"""))

        email_context = {'event': self.event, 'code': self.code}

        mail(self.email,
             _("Here's your verification code for {event}").format(
                 event=str(self.event)),
             email_content,
             email_context,
             self.event,
             locale=locale)
Example #2
0
    def _send_confirmation_email(self, *args, **kwargs):
        locale = 'en'
        email = kwargs.pop('email')
        name = kwargs.pop('name')
        event = kwargs.pop('event')

        with language(locale):
            email_content = LazyI18nString.from_gettext(
                ugettext_noop("""Dear {name} ,

Thank you for applying for an IFF Ticket. We are currently reviewing ticket requests, and as space becomes available, we will be issuing tickets.

If you have any questions, please email [email protected]

Best regards,
Your {event} team"""))

            email_context = {'event': event, 'name': name}

            mail(email,
                 _('Your {event} ticket request').format(event=str(event)),
                 email_content,
                 email_context,
                 event,
                 locale=locale)
Example #3
0
def send_update_notification_email():
    gs = GlobalSettings()
    if not gs.settings.update_check_email:
        return

    mail_send_task.apply_async(
        kwargs={
            "to": [gs.settings.update_check_email],
            "subject": _("pretalx update available"),
            "body": str(
                LazyI18nString.from_gettext(
                    gettext_noop(
                        "Hi!\n\nAn update is available for pretalx or for one of the plugins you installed in your "
                        "pretalx installation at {base_url}.\nPlease follow this link for more information:\n\n {url} \n\n"
                        "You can always find information on the latest updates in the changelog:\n\n"
                        "  https://docs.pretalx.org/changelog.html\n\n"
                        "Larger updates are also announced with upgrade notes on the pretalx.com blog:\n\n"
                        "  https://pretalx.com/p/news"
                        "\n\nBest regards,\nyour pretalx developers"
                    ),
                )
            ).format(
                base_url=settings.SITE_URL,
                url=settings.SITE_URL + reverse("orga:admin.update"),
            ),
            "html": None,
        }
    )
Example #4
0
def send_update_notification_email():
    gs = GlobalSettingsObject()
    if not gs.settings.update_check_email:
        return

    mail(
        gs.settings.update_check_email,
        _('pretix update available'),
        LazyI18nString.from_gettext(
            gettext_noop(
                'Hi!\n\nAn update is available for pretix or for one of the plugins you installed in your '
                'pretix installation. Please click on the following link for more information:\n\n {url} \n\n'
                'You can always find information on the latest updates on the pretix.eu blog:\n\n'
                'https://pretix.eu/about/en/blog/'
                '\n\nBest,\n\nyour pretix developers')),
        {'url': build_absolute_uri('control:global.update')},
    )
Example #5
0
def send_update_notification_email():
    gs = GlobalSettingsObject()
    if not gs.settings.update_check_email:
        return

    mail(
        gs.settings.update_check_email,
        _('pretix update available'),
        LazyI18nString.from_gettext(
            ugettext_noop(
                'Hi!\n\nAn update is available for pretix or for one of the plugins you installed in your '
                'pretix installation. Please click on the following link for more information:\n\n {url} \n\n'
                'You can always find information on the latest updates on the pretix.eu blog:\n\n'
                'https://pretix.eu/about/en/blog/'
                '\n\nBest,\n\nyour pretix developers'
            )
        ),
        {
            'url': build_absolute_uri('control:global.update')
        },
    )
Example #6
0
def send_invoices_to_organizer(sender, **kwargs):
    from pretix.base.services.mail import mail

    batch_size = 50
    # this adds some rate limiting on the number of invoices to send at the same time. If there's more, the next
    # cronjob will handle them
    max_number_of_batches = 10

    for i in range(max_number_of_batches):
        with transaction.atomic():
            qs = Invoice.objects.filter(
                sent_to_organizer__isnull=True).prefetch_related(
                    'event').select_for_update(skip_locked=True)
            for i in qs[:batch_size]:
                if i.event.settings.invoice_email_organizer:
                    with language(i.event.settings.locale):
                        mail(
                            email=i.event.settings.invoice_email_organizer,
                            subject=_('New invoice: {number}').format(
                                number=i.number),
                            template=LazyI18nString.from_gettext(
                                _('Hello,\n\n'
                                  'a new invoice for {event} has been created, see attached.\n\n'
                                  'We are sending this email because you configured us to do so in your event settings.'
                                  )),
                            context={
                                'event': str(i.event),
                            },
                            locale=i.event.settings.locale,
                            event=i.event,
                            invoices=[i],
                            auto_email=True,
                        )
                    i.sent_to_organizer = True
                    i.save(update_fields=['sent_to_organizer'])
                else:
                    i.sent_to_organizer = False
                i.save(update_fields=['sent_to_organizer'])
Example #7
0
    def done(self, form_list, form_dict, **kwargs):
        foundation_data = self.get_cleaned_data_for_step('foundation')
        basics_data = self.get_cleaned_data_for_step('basics')
        copy_data = self.get_cleaned_data_for_step('copy')

        with transaction.atomic(), language(basics_data['locale']):
            event = form_dict['basics'].instance
            event.organizer = foundation_data['organizer']
            event.plugins = settings.PRETIX_PLUGINS_DEFAULT
            event.has_subevents = foundation_data['has_subevents']
            form_dict['basics'].save()

            has_control_rights = self.request.user.teams.filter(
                organizer=event.organizer, all_events=True, can_change_event_settings=True, can_change_items=True,
                can_change_orders=True, can_change_vouchers=True
            ).exists()
            if not has_control_rights:
                t = Team.objects.create(
                    organizer=event.organizer, name=_('Team {event}').format(event=event.name),
                    can_change_event_settings=True, can_change_items=True,
                    can_view_orders=True, can_change_orders=True, can_view_vouchers=True,
                    can_change_vouchers=True
                )
                t.members.add(self.request.user)
                t.limit_events.add(event)

            if event.has_subevents:
                se = event.subevents.create(
                    name=event.name,
                    date_from=event.date_from,
                    date_to=event.date_to,
                    presale_start=event.presale_start,
                    presale_end=event.presale_end,
                    location=event.location,
                    active=True
                )

            if basics_data['tax_rate']:
                event.settings.tax_rate_default = event.tax_rules.create(
                    name=LazyI18nString.from_gettext(ugettext('VAT')),
                    rate=basics_data['tax_rate']
                )

            logdata = {}
            for f in form_list:
                logdata.update({
                    k: v for k, v in f.cleaned_data.items()
                })
            event.log_action('pretix.event.settings', user=self.request.user, data=logdata)

            if copy_data and copy_data['copy_from_event']:
                from_event = copy_data['copy_from_event']
                event.copy_data_from(from_event)
            elif event.has_subevents:
                event.checkin_lists.create(
                    name=str(se),
                    all_products=True,
                    subevent=se
                )
            else:
                event.checkin_lists.create(
                    name=_('Default'),
                    all_products=True
                )

            event.settings.set('timezone', basics_data['timezone'])
            event.settings.set('locale', basics_data['locale'])
            event.settings.set('locales', foundation_data['locales'])

        if (copy_data and copy_data['copy_from_event']) or event.has_subevents:
            return redirect(reverse('control:event.settings', kwargs={
                'organizer': event.organizer.slug,
                'event': event.slug,
            }) + '?congratulations=1')
        else:
            return redirect(reverse('control:event.quick', kwargs={
                'organizer': event.organizer.slug,
                'event': event.slug,
            }) + '?congratulations=1')
Example #8
0
        'type': str
    },
    'mail_text_signature': {
        'type': LazyI18nString,
        'default': ""
    },
    'mail_text_resend_link': {
        'type':
        LazyI18nString,
        'default':
        LazyI18nString.from_gettext(
            ugettext_noop("""Hello,

you receive this message because you asked us to send you the link
to your order for {event}.

You can change your order details and view the status of your order at
{url}

Best regards,
Your {event} team"""))
    },
    'mail_text_resend_all_links': {
        'type':
        LazyI18nString,
        'default':
        LazyI18nString.from_gettext(
            ugettext_noop("""Hello,

somebody requested a list of your orders for {event}.
The list is as follows:
Example #9
0
hierarkey.add_default("cfp_count_length_in", "chars", str)
hierarkey.add_default("cfp_title_min_length", None, int)
hierarkey.add_default("cfp_abstract_min_length", None, int)
hierarkey.add_default("cfp_description_min_length", None, int)
hierarkey.add_default("cfp_biography_min_length", None, int)
hierarkey.add_default("cfp_title_max_length", None, int)
hierarkey.add_default("cfp_abstract_max_length", None, int)
hierarkey.add_default("cfp_description_max_length", None, int)
hierarkey.add_default("cfp_biography_max_length", None, int)

hierarkey.add_default("review_score_mandatory", "False", bool)
hierarkey.add_default("review_text_mandatory", "False", bool)
hierarkey.add_default(
    "review_help_text",
    LazyI18nString.from_gettext(
        gettext_noop(
            "Please give a fair review on why you'd like to see this submission at the conference, or why you think it would not be a good fit."
        )),
    LazyI18nString,
)

hierarkey.add_default("mail_from", "", str)
hierarkey.add_default("mail_reply_to", "", str)
hierarkey.add_default("mail_subject_prefix", "", str)
hierarkey.add_default("mail_signature", "", str)
hierarkey.add_default("smtp_use_custom", "False", bool)
hierarkey.add_default("smtp_host", "", str)
hierarkey.add_default("smtp_port", "587", int)
hierarkey.add_default("smtp_username", "", str)
hierarkey.add_default("smtp_password", "", str)
hierarkey.add_default("smtp_use_tls", "True", bool)
hierarkey.add_default("smtp_use_ssl", "False", bool)
Example #10
0
                   f.xmldata)

    def shred_data(self):
        self.event.sepa_exports.update(xmldata="<shredded></shredded>")


@receiver(register_data_shredders, dispatch_uid="sepadebit_shredders")
def register_shredder(sender, **kwargs):
    return [
        PaymentLogsShredder,
    ]


settings_hierarkey.add_default(
    "payment_sepadebit_pre_notification_mail_subject",
    LazyI18nString.from_gettext(
        gettext_noop("Upcomming debit of {debit_amount_with_currency}")),
    LazyI18nString,
)

settings_hierarkey.add_default(
    "payment_sepadebit_pre_notification_mail_body",
    LazyI18nString.from_gettext(
        gettext_noop(
            "Hello,\n\n"
            "you ordered a ticket for {event}.\n\n"
            "We will debit your bank account {iban} on or shortly after {due_date}. The payment will appear on your bank statement as {creditor_name} with reference {reference} and creditor identifier {creditor_id}.\n\n"
            "You can change your order details and view the status of your order at\n"
            "{url}\n\n"
            "Best regards,\n"
            "Your {event} team")),
    LazyI18nString,
Example #11
0
    def __init__(self, *args, **kwargs):
        self.event = kwargs.pop('event')
        kwargs.setdefault('initial', {})
        kwargs['initial']['gift_card_expires'] = self.event.organizer.default_gift_card_expiry
        super().__init__(*args, **kwargs)
        self.fields['send_subject'] = I18nFormField(
            label=_("Subject"),
            required=True,
            widget_kwargs={'attrs': {'data-display-dependency': '#id_send'}},
            initial=_('Canceled: {event}'),
            widget=I18nTextInput,
            locales=self.event.settings.get('locales'),
        )
        self.fields['send_message'] = I18nFormField(
            label=_('Message'),
            widget=I18nTextarea,
            required=True,
            widget_kwargs={'attrs': {'data-display-dependency': '#id_send'}},
            locales=self.event.settings.get('locales'),
            initial=LazyI18nString.from_gettext(gettext_noop(
                'Hello,\n\n'
                'with this email, we regret to inform you that {event} has been canceled.\n\n'
                'We will refund you {refund_amount} to your original payment method.\n\n'
                'You can view the current state of your order here:\n\n{url}\n\nBest regards,\n\n'
                'Your {event} team'
            ))
        )

        self._set_field_placeholders('send_subject', ['event_or_subevent', 'refund_amount', 'position_or_address',
                                                      'order', 'event'])
        self._set_field_placeholders('send_message', ['event_or_subevent', 'refund_amount', 'position_or_address',
                                                      'order', 'event'])
        self.fields['send_waitinglist_subject'] = I18nFormField(
            label=_("Subject"),
            required=True,
            initial=_('Canceled: {event}'),
            widget=I18nTextInput,
            widget_kwargs={'attrs': {'data-display-dependency': '#id_send_waitinglist'}},
            locales=self.event.settings.get('locales'),
        )
        self.fields['send_waitinglist_message'] = I18nFormField(
            label=_('Message'),
            widget=I18nTextarea,
            required=True,
            locales=self.event.settings.get('locales'),
            widget_kwargs={'attrs': {'data-display-dependency': '#id_send_waitinglist'}},
            initial=LazyI18nString.from_gettext(gettext_noop(
                'Hello,\n\n'
                'with this email, we regret to inform you that {event} has been canceled.\n\n'
                'You will therefore not receive a ticket from the waiting list.\n\n'
                'Best regards,\n\n'
                'Your {event} team'
            ))
        )
        self._set_field_placeholders('send_waitinglist_subject', ['event_or_subevent', 'event'])
        self._set_field_placeholders('send_waitinglist_message', ['event_or_subevent', 'event'])

        if self.event.has_subevents:
            self.fields['subevent'].queryset = self.event.subevents.all()
            self.fields['subevent'].widget = Select2(
                attrs={
                    'data-inverse-dependency': '#id_all_subevents',
                    'data-model-select2': 'event',
                    'data-select2-url': reverse('control:event.subevents.select2', kwargs={
                        'event': self.event.slug,
                        'organizer': self.event.organizer.slug,
                    }),
                    'data-placeholder': pgettext_lazy('subevent', 'All dates')
                }
            )
            self.fields['subevent'].widget.choices = self.fields['subevent'].choices
        else:
            del self.fields['subevent']
            del self.fields['all_subevents']
        change_decimal_field(self.fields['keep_fee_fixed'], self.event.currency)
Example #12
0
    },
    'mail_from': {
        'default': settings.MAIL_FROM,
        'type': str
    },
    'mail_text_signature': {
        'type': LazyI18nString,
        'default': ""
    },
    'mail_text_resend_link': {
        'type': LazyI18nString,
        'default': LazyI18nString.from_gettext(ugettext_noop("""Hello,

you receive this message because you asked us to send you the link
to your order for {event}.

You can change your order details and view the status of your order at
{url}

Best regards,
Your {event} team"""))
    },
    'mail_text_resend_all_links': {
        'type': LazyI18nString,
        'default': LazyI18nString.from_gettext(ugettext_noop("""Hello,

somebody requested a list of your orders for {event}.
The list is as follows:

{orders}

Best regards,
Example #13
0
from django.utils.translation import ugettext_lazy as _
from i18nfield.strings import LazyI18nString

SUBJECT = LazyI18nString.from_gettext(_('Your Receipt'))
TEXT = LazyI18nString.from_gettext(
    _('''Hi,

This is your official receipt for fees and donations rendered to us last
year.  As the finance autorities usually do not want to see receipts,
and we are not allowed to sign receipts digitally, please keep it like
this. If you need to send it in, come around and we'll sign it.

Thanks,
the robo clerk'''))
Example #14
0
 def get_initial(self):
     return {'name': LazyI18nString.from_gettext(ugettext('VAT'))}
Example #15
0
            kwargs={
                "event": d.get("event_slug"),
                "organizer": logentry.organizer.slug,
                "code": d.get("order"),
            },
        )
        return mark_safe(
            _("This order has been scheduled as the second dose for order {order}"
              ).format(order='<a href="{}">{}</a>'.format(url,
                                                          d.get("order")), ))


settings_hierarkey.add_default("vacc_autosched_mail", False, bool)
settings_hierarkey.add_default(
    "vacc_autosched_subject",
    LazyI18nString.from_gettext(
        gettext_noop("Your second dose: {scheduled_datetime}")),
    LazyI18nString,
)
settings_hierarkey.add_default(
    "vacc_autosched_body",
    LazyI18nString.from_gettext(
        gettext_noop(
            "Hello,\n\n"
            "we scheduled your second dose for {scheduled_datetime}.\n\n"
            "Please find additional information in your ticket attached.\n\n"
            "Best regards,\n"
            "Your {event} team")),
    LazyI18nString,
)
settings_hierarkey.add_default("doistep_record_ip", False, bool)
Example #16
0
from i18nfield.strings import LazyI18nString
from django.utils.translation import ugettext_lazy as _

MANDATE_REFERENCE_NOTIFICATION_SUBJECT = LazyI18nString.from_gettext(
    _('SEPA Direct Debit mandate reference notification'))
MANDATE_REFERENCE_NOTIFICATION_TEXT = LazyI18nString.from_gettext(
    _('''Hi,

this is to inform you of the SEPA mandate reference we will be using in the
future to issue direct debits for your {association_name} membership fees.

 Mandate reference: {sepa_mandate_reference}
 Your IBAN on file: {sepa_iban}
 Your BIC:          {sepa_bic}
 
 Our Creditor ID:   {creditor_id}

If you have any questions relating to your member fees or you want to update
your member data, please contact us at {contact}.

{additional_information}

Thanks,
the robo clerk'''))

DEBIT_NOTIFICATION_SUBJECT = LazyI18nString.from_gettext(
    _('SEPA Direct Debit notification'))
DEBIT_NOTIFICATION_TEXT = LazyI18nString.from_gettext(
    _('''Hi,
        
this is to inform you of the SEPA direct debit we'll be issuing based on
Example #17
0
        ).values_list('pk', flat=True))

    for eventpk in events:
        consent_to_checkin.apply(args=(eventpk, ))


settings_hierarkey.add_default('pretix_atfconsent_enabled', False, bool)
settings_hierarkey.add_default(
    'pretix_atfconsent_explanation',
    LazyI18nString.from_gettext(
        gettext_noop(
            "Due to the evolving nature of our event, the following information was not yet available at the time "
            "when you registered for this event.\r\n"
            "\r\n"
            "Please take a moment of your time to read through the provided information and confirm that you agree "
            "with the posted information.\r\n"
            "\r\n"
            "Should you not agree with the conditions outlined, we will unfortunately have to cancel your. In this case "
            "you will be provided with a full refund.\r\n"
            "\r\n"
            "If you would like to actively dispute the conditions below and not wait for us to cancel your order due to "
            "non-agreement of the conditions outlined below, feel free to contact us directly at any time."
        )), LazyI18nString)
settings_hierarkey.add_default(
    'pretix_atfconsent_short_explanation',
    LazyI18nString.from_gettext(
        gettext_noop(
            "Due to the evolving nature of our event, some information was not yet available at the time "
            "when you registered for this event.\r\n"
            "\r\n"
            "Please click the button, take a moment of your time to read through the provided information and confirm "
            "that you agree with the posted information.\r\n"
Example #18
0
def resolve_i18n_string(i18n_str):
    value = LazyI18nString.from_gettext(_(i18n_str)).data
    return json.dumps({lng: value[lng] for lng, lngname in settings.LANGUAGES if value[lng]}, sort_keys=True)
Example #19
0
            "cwa_url",
            ["event", "position"],
            lambda event, position: generate_url(event, position.subevent)[0],
            lambda event: generate_url(event, event.subevents.first())[0],
        ),
    ]
    return ph


settings_hierarkey.add_default("cwa_mode", "daily", str)
settings_hierarkey.add_default("cwa_default_length", None, int)
settings_hierarkey.add_default("cwa_location_type", "0", str)
settings_hierarkey.add_default("cwa_checkin_email", "True", bool)
settings_hierarkey.add_default(
    "cwa_checkin_email_subject",
    LazyI18nString.from_gettext(
        gettext_noop("Welcome! Remember to check in with Corona Warn App")),
    LazyI18nString,
)
settings_hierarkey.add_default(
    "cwa_checkin_email_body",
    LazyI18nString.from_gettext(
        gettext_noop(
            "Hello,\n\n"
            "now that you've arrived, we kindly ask you to check in with Corona Warn App by clicking the following link:\n\n"
            "{cwa_url}\n\n"
            "Have a great time!\n\n"
            "Best regards,\n"
            "Your {event} team")),
    LazyI18nString,
)
Example #20
0
from django.utils.translation import ugettext_noop as _
from i18nfield.strings import LazyI18nString

GENERIC_SUBJECT = LazyI18nString.from_gettext(
    _('Your submission: {submission_title}'))

ACK_TEXT = LazyI18nString.from_gettext(
    _('''Hi!

We have received your submission "{submission_title}" to
{event_name}. We will notify you once we have had time to consider all
submissions, but until then you can see and edit your submission at
{submission_url}.

Please do not hesitate to contact us if you have any questions!

The {event_name} orga'''))

ACCEPT_TEXT = LazyI18nString.from_gettext(
    _('''Hi!

We are happy to tell you that we accept your submission "{submission_title}"
to {event_name}. Please click this link to confirm your attendance:

    {confirmation_link}

We look forward to seeing you at {event_name} - Please contact us if you have any
questions! We will reach out again before the conference to tell you details
about your slot in the schedule and technical details concerning the room
and presentation tech.
Example #21
0
                            serialize=lambda s: json.dumps(s.data),
                            unserialize=i18n_uns)


settings_hierarkey.add_default('show_schedule', 'True', bool)
settings_hierarkey.add_default('export_html_on_schedule_release', 'True', bool)
settings_hierarkey.add_default('custom_domain', '', str)

settings_hierarkey.add_default('display_header_pattern', '', str)

settings_hierarkey.add_default('allow_override_votes', 'False', bool)
settings_hierarkey.add_default('review_min_score', 0, int)
settings_hierarkey.add_default('review_max_score', 1, int)
settings_hierarkey.add_default('review_score_mandatory', 'False', bool)
settings_hierarkey.add_default('review_text_mandatory', 'False', bool)
settings_hierarkey.add_default('review_help_text', LazyI18nString.from_gettext(ugettext_noop("Please give a fair review on why you'd like to see this submission at the conference, or why you think it would not be a good fit.")), LazyI18nString)

settings_hierarkey.add_default('mail_from', '*****@*****.**', str)
settings_hierarkey.add_default('smtp_use_custom', 'False', bool)
settings_hierarkey.add_default('smtp_host', '', str)
settings_hierarkey.add_default('smtp_port', '587', int)
settings_hierarkey.add_default('smtp_username', '', str)
settings_hierarkey.add_default('smtp_password', '', str)
settings_hierarkey.add_default('smtp_use_tls', 'True', bool)
settings_hierarkey.add_default('smtp_use_ssl', 'False', bool)

settings_hierarkey.add_default('mail_text_reset', LazyI18nString.from_gettext(ugettext_noop("""Hello {name},

you have requested a new password for your submission account at {event}.

To reset your password, click on the following link:
Example #22
0
from django.utils.translation import ugettext_lazy as _
from i18nfield.strings import LazyI18nString

WELCOME_MEMBER_SUBJECT = LazyI18nString.from_gettext(_('Welcome, latest member!'))
WELCOME_MEMBER_TEXT = LazyI18nString.from_gettext(_('''Hi,

welcome to {name}! You're now officially our latest member. Your member ID
is {number}. If you have any questions relating to your member fees or
you want to update your member data, please contact us at {contact}.

{additional_information}

Thanks,
the robo clerk'''))

WELCOME_OFFICE_SUBJECT = LazyI18nString.from_gettext(_('[byro] New member'))
WELCOME_OFFICE_TEXT = LazyI18nString.from_gettext(_('''Hi,

we have a new member: {member_name}

{additional_information}

Thanks,
the robo clerk'''))

LEAVE_MEMBER_SUBJECT = LazyI18nString.from_gettext(_('Goodbye!'))
LEAVE_MEMBER_TEXT = LazyI18nString.from_gettext(_('''Hi,

we are sorry that you will leave us at {end}.

{additional_information}
Example #23
0
    def done(self, form_list, form_dict, **kwargs):
        foundation_data = self.get_cleaned_data_for_step('foundation')
        basics_data = self.get_cleaned_data_for_step('basics')
        copy_data = self.get_cleaned_data_for_step('copy')

        with transaction.atomic(), language(basics_data['locale']):
            event = form_dict['basics'].instance
            event.organizer = foundation_data['organizer']
            event.has_subevents = foundation_data['has_subevents']
            event.testmode = True
            form_dict['basics'].save()
            event.set_active_plugins(
                settings.PRETIX_PLUGINS_DEFAULT.split(","),
                allow_restricted=settings.PRETIX_PLUGINS_DEFAULT.split(","))
            event.save(update_fields=['plugins'])
            event.log_action(
                'pretix.event.added',
                user=self.request.user,
            )

            if not EventWizardBasicsForm.has_control_rights(
                    self.request.user, event.organizer, self.request.session):
                if basics_data["team"] is not None:
                    t = basics_data["team"]
                    t.limit_events.add(event)
                elif event.organizer.settings.event_team_provisioning:
                    t = Team.objects.create(
                        organizer=event.organizer,
                        name=_('Team {event}').format(event=event.name),
                        can_change_event_settings=True,
                        can_change_items=True,
                        can_view_orders=True,
                        can_change_orders=True,
                        can_view_vouchers=True,
                        can_change_vouchers=True)
                    t.members.add(self.request.user)
                    t.limit_events.add(event)

            logdata = {}
            for f in form_list:
                logdata.update({k: v for k, v in f.cleaned_data.items()})
            event.log_action('pretix.event.settings',
                             user=self.request.user,
                             data=logdata)

            if copy_data and copy_data['copy_from_event']:
                from_event = copy_data['copy_from_event']
                event.copy_data_from(from_event)
            elif self.clone_from:
                event.copy_data_from(self.clone_from)
            else:
                event.checkin_lists.create(name=_('Default'),
                                           all_products=True)
                event.set_defaults()

            if basics_data['tax_rate']:
                if not event.settings.tax_rate_default or event.settings.tax_rate_default.rate != basics_data[
                        'tax_rate']:
                    event.settings.tax_rate_default = event.tax_rules.create(
                        name=LazyI18nString.from_gettext(gettext('VAT')),
                        rate=basics_data['tax_rate'])

            event.settings.set('timezone', basics_data['timezone'])
            event.settings.set('locale', basics_data['locale'])
            event.settings.set('locales', foundation_data['locales'])

        if (copy_data and copy_data['copy_from_event']
            ) or self.clone_from or event.has_subevents:
            return redirect(
                reverse('control:event.settings',
                        kwargs={
                            'organizer': event.organizer.slug,
                            'event': event.slug,
                        }) + '?congratulations=1')
        else:
            return redirect(
                reverse('control:event.quick',
                        kwargs={
                            'organizer': event.organizer.slug,
                            'event': event.slug,
                        }) + '?congratulations=1')
Example #24
0
        return {}
    return {
        'ml_newsletter':
        forms.BooleanField(
            label=rich_text_snippet(sender.settings.newsletter_ml_text),
            required=False,
        )
    }


@receiver(signal=logentry_display,
          dispatch_uid="newsletter_ml_logentry_display")
def pretixcontrol_logentry_display(sender, logentry, **kwargs):
    if not logentry.action_type.startswith('pretix_newsletter_ml'):
        return

    plains = {
        'pretix_newsletter_ml.subscribe':
        _("A subscribe request for the mailing list has been sent."),
    }

    if logentry.action_type in plains:
        return plains[logentry.action_type]


settings_hierarkey.add_default(
    'newsletter_ml_text',
    LazyI18nString.from_gettext(
        gettext_noop("Yes, I want to receive the organizer's newsletter")),
    LazyI18nString)
Example #25
0
from django.dispatch import receiver
from django.utils.translation import gettext_noop
from i18nfield.strings import LazyI18nString
from rest_framework import serializers

from pretix.base.settings import settings_hierarkey
from pretix.base.signals import register_payment_providers, api_event_settings_fields


@receiver(register_payment_providers, dispatch_uid="payment_cash")
def register_payment_provider(sender, **kwargs):
    from .payment import CashPayment
    return CashPayment


@receiver(api_event_settings_fields,
          dispatch_uid="cashpayment_api_event_settings_fields")
def api_event_settings_fields(sender, **kwargs):
    return {
        'payment_cashpayment__enabled':
        serializers.BooleanField(required=False),
    }


settings_hierarkey.add_default(
    'payment_cashpayment_information_text',
    LazyI18nString.from_gettext(
        gettext_noop("You can pay your order by cash at the venue.")),
    LazyI18nString)
Example #26
0
from django.utils.translation import gettext_noop as _
from i18nfield.strings import LazyI18nString

GENERIC_SUBJECT = LazyI18nString.from_gettext(_("Your proposal: {submission_title}"))

ACK_TEXT = LazyI18nString.from_gettext(
    _(
        """Hi!

We have received your proposal "{submission_title}" to
{event_name}. We will notify you once we have had time to consider all
proposals, but until then you can see and edit your proposal at
{submission_url}.

Please do not hesitate to contact us if you have any questions!

The {event_name} organisers"""
    )
)

ACCEPT_TEXT = LazyI18nString.from_gettext(
    _(
        """Hi!

We are happy to tell you that we accept your proposal "{submission_title}"
to {event_name}. Please click this link to confirm your attendance:

    {confirmation_link}

We look forward to seeing you at {event_name} - Please contact us if you have any
questions! We will reach out again before the conference to tell you details
Example #27
0
settings_hierarkey.add_default('mail_from', '*****@*****.**', str)
settings_hierarkey.add_default('smtp_use_custom', 'False', bool)
settings_hierarkey.add_default('smtp_host', '', str)
settings_hierarkey.add_default('smtp_port', '587', int)
settings_hierarkey.add_default('smtp_username', '', str)
settings_hierarkey.add_default('smtp_password', '', str)
settings_hierarkey.add_default('smtp_use_tls', 'True', bool)
settings_hierarkey.add_default('smtp_use_ssl', 'False', bool)

settings_hierarkey.add_default('mail_text_reset', LazyI18nString.from_gettext(ugettext_noop("""Hello {name},

you have requested a new password for your submission account at {event}.

To reset your password, click on the following link:

{url}

If this wasn't you, you can just ignore this email.

All the best,
your {event} team.
""")), LazyI18nString)
settings_hierarkey.add_default('mail_on_new_submission', 'False', bool)
settings_hierarkey.add_default('mail_text_new_submission', LazyI18nString.from_gettext(ugettext_noop("""Hi,

you have received a new submission for your event {event_name}:
»{submission_title}« by {speakers}.
You can see details at

  {orga_url}
Example #28
0
    # ops = OrderPosition.objects.filter(meta_info__contains='"googlepaypass"')
    # for op in ops:
    #     comms = Comms(op.event.settings.get('googlepaypasses_credentials'))
    #     meta_info = json.loads(op.meta_info or '{}')
    #     object_id = meta_info['googlepaypass']
    #
    #     item = comms.get_item(ObjectType.eventTicketObject, object_id)
    #
    #     if item and not item['hasUsers']:
    #         tasks.shred_object(op.pk)

    return


settings_hierarkey.add_default(
    'ticketoutput_googlepaypasses_disclaimer_text',
    LazyI18nString.from_gettext(ugettext_noop(
        "Please be aware, that contrary to other virtual wallets/passes (like Apple Wallet), Google Pay Passes are not "
        "handled offline. Every pass that is created, has to be transmitted to Google Inc.\r\n"
        "\r\n"
        "By clicking the **Save to phone**-button below, we will transfer some of your personal information, which is "
        "necessary to provide you with your Google Pay Pass, to Google Inc.\r\n"
        "\r\n"
        "Please be aware, that there is no way to delete the data, once it has been transmitted.\r\n"
        "\r\n"
        "However we will anonymize all passes that are not linked to a device on a regular, best effort basis. While "
        "this will remove your personal information from the pass, we cannot guarantee that Google is not keeping a "
        "history of the previous passes.")),
    LazyI18nString
)
Example #29
0
from django.utils.translation import ugettext_lazy as _
from i18nfield.strings import LazyI18nString

WELCOME_MEMBER_SUBJECT = LazyI18nString.from_gettext(_('Welcome, latest member!'))
WELCOME_MEMBER_TEXT = LazyI18nString.from_gettext(
    _(
        '''Hi,

welcome to {name}! You're now officially our latest member. Your member ID
is {number}. If you have any questions relating to your member fees or
you want to update your member data, please contact us at {contact}.

{additional_information}

Thanks,
the robo clerk'''
    )
)

WELCOME_OFFICE_SUBJECT = LazyI18nString.from_gettext(_('[byro] New member'))
WELCOME_OFFICE_TEXT = LazyI18nString.from_gettext(
    _(
        '''Hi,

we have a new member: {member_name}

{additional_information}

Thanks,
the robo clerk'''
    )
Example #30
0
        'type': str
    },
    'mail_text_signature': {
        'type': LazyI18nString,
        'default': ""
    },
    'mail_text_resend_link': {
        'type':
        LazyI18nString,
        'default':
        LazyI18nString.from_gettext(
            ugettext_noop("""Hello,

you receive this message because you asked us to send you the link
to your order for {event}.

You can change your order details and view the status of your order at
{url}

Best regards,
Your {event} team"""))
    },
    'mail_text_resend_all_links': {
        'type':
        LazyI18nString,
        'default':
        LazyI18nString.from_gettext(
            ugettext_noop("""Hello,

somebody requested a list of your orders for {event}.
The list is as follows:
Example #31
0
def test_from_gettext():
    gstr = ugettext_noop('Welcome')
    lstr = LazyI18nString.from_gettext(gstr)
    assert 'de' in lstr.data
    assert lstr.data['en'] == 'Welcome'
Example #32
0
    def done(self, form_list, form_dict, **kwargs):
        foundation_data = self.get_cleaned_data_for_step('foundation')
        basics_data = self.get_cleaned_data_for_step('basics')
        copy_data = self.get_cleaned_data_for_step('copy')

        with transaction.atomic(), language(basics_data['locale']):
            event = form_dict['basics'].instance
            event.organizer = foundation_data['organizer']
            event.plugins = settings.PRETIX_PLUGINS_DEFAULT
            event.has_subevents = foundation_data['has_subevents']
            form_dict['basics'].save()

            has_control_rights = self.request.user.teams.filter(
                organizer=event.organizer,
                all_events=True,
                can_change_event_settings=True,
                can_change_items=True,
                can_change_orders=True,
                can_change_vouchers=True).exists()
            if not has_control_rights:
                t = Team.objects.create(
                    organizer=event.organizer,
                    name=_('Team {event}').format(event=event.name),
                    can_change_event_settings=True,
                    can_change_items=True,
                    can_view_orders=True,
                    can_change_orders=True,
                    can_view_vouchers=True,
                    can_change_vouchers=True)
                t.members.add(self.request.user)
                t.limit_events.add(event)

            if event.has_subevents:
                se = event.subevents.create(name=event.name,
                                            date_from=event.date_from,
                                            date_to=event.date_to,
                                            presale_start=event.presale_start,
                                            presale_end=event.presale_end,
                                            location=event.location,
                                            active=True)

            if basics_data['tax_rate']:
                event.settings.tax_rate_default = event.tax_rules.create(
                    name=LazyI18nString.from_gettext(ugettext('VAT')),
                    rate=basics_data['tax_rate'])

            logdata = {}
            for f in form_list:
                logdata.update({k: v for k, v in f.cleaned_data.items()})
            event.log_action('pretix.event.settings',
                             user=self.request.user,
                             data=logdata)

            if copy_data and copy_data['copy_from_event']:
                from_event = copy_data['copy_from_event']
                event.copy_data_from(from_event)
            elif event.has_subevents:
                event.checkin_lists.create(name=str(se),
                                           all_products=True,
                                           subevent=se)
            else:
                event.checkin_lists.create(name=_('Default'),
                                           all_products=True)

            event.settings.set('timezone', basics_data['timezone'])
            event.settings.set('locale', basics_data['locale'])
            event.settings.set('locales', foundation_data['locales'])

        return redirect(
            reverse('control:event.settings',
                    kwargs={
                        'organizer': event.organizer.slug,
                        'event': event.slug,
                    }) + '?congratulations=1')
Example #33
0
@settings_hierarkey.set_global()
class GlobalSettings(GlobalSettingsBase):
    pass


settings_hierarkey.add_default('cfp_show_settings', 'False', bool)
settings_hierarkey.add_default('mail_from', '*****@*****.**', str)
settings_hierarkey.add_default('smtp_use_custom', 'False', bool)
settings_hierarkey.add_default('smtp_host', '', str)
settings_hierarkey.add_default('smtp_port', '587', int)
settings_hierarkey.add_default('smtp_username', '', str)
settings_hierarkey.add_default('smtp_password', '', str)
settings_hierarkey.add_default('smtp_use_tls', 'True', bool)
settings_hierarkey.add_default('smtp_use_ssl', 'False', bool)
settings_hierarkey.add_default(
    'mail_text_reset',
    LazyI18nString.from_gettext(
        ugettext_noop("""Hello {name},

you have requested a new password for your submission account at {event}.

To reset your password, click on the following link:

{url}

If this wasn't you, you can just ignore this email.

All the best,
your {event} team.
""")), LazyI18nString)