mirror of
https://github.com/pretix/pretix.git
synced 2025-12-06 21:42:49 +00:00
add voucher code in success message (#426)
* add voucher code in success message * change voucher message
This commit is contained in:
@@ -215,7 +215,7 @@ class VoucherCreate(EventPermissionRequiredMixin, CreateView):
|
||||
@transaction.atomic
|
||||
def form_valid(self, form):
|
||||
form.instance.event = self.request.event
|
||||
messages.success(self.request, _('The new voucher has been created.'))
|
||||
messages.success(self.request, _('The new voucher has been created: {code}').format(code=form.instance.code))
|
||||
ret = super().form_valid(form)
|
||||
form.instance.log_action('pretix.voucher.added', data=dict(form.cleaned_data), user=self.request.user)
|
||||
return ret
|
||||
|
||||
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-01 20:23+0000\n"
|
||||
"POT-Creation-Date: 2017-03-04 04:00+0000\n"
|
||||
"PO-Revision-Date: 2017-03-01 21:25+0100\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: Raphael Michel <michel@rami.io>\n"
|
||||
@@ -5900,8 +5900,9 @@ msgid "The selected voucher has been deleted."
|
||||
msgstr "Der ausgewählte Gutschein wurde gelöscht."
|
||||
|
||||
#: pretix/control/views/vouchers.py:218
|
||||
msgid "The new voucher has been created."
|
||||
msgstr "Der neue Gutschein wurde erstellt."
|
||||
#, fuzzy, python-brace-format
|
||||
msgid "The new voucher has been created: {code}"
|
||||
msgstr "Der neue Gutschein wurde erstellt: {code}"
|
||||
|
||||
#: pretix/control/views/vouchers.py:250
|
||||
msgid "The new vouchers have been created."
|
||||
@@ -7779,15 +7780,15 @@ msgstr ""
|
||||
"Wir haben Sie zur Warteliste hinzugefügt. Sie erhalten eine E-Mail, sobald "
|
||||
"wieder Tickets verfügbar sind."
|
||||
|
||||
#: pretix/settings.py:281
|
||||
#: pretix/settings.py:284
|
||||
msgid "English"
|
||||
msgstr "Englisch"
|
||||
|
||||
#: pretix/settings.py:282
|
||||
#: pretix/settings.py:285
|
||||
msgid "German"
|
||||
msgstr "Deutsch"
|
||||
|
||||
#: pretix/settings.py:283
|
||||
#: pretix/settings.py:286
|
||||
msgid "German (informal)"
|
||||
msgstr "Deutsch (Du)"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-01 20:23+0000\n"
|
||||
"POT-Creation-Date: 2017-03-04 04:00+0000\n"
|
||||
"PO-Revision-Date: 2017-01-01 20:40+0100\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: \n"
|
||||
|
||||
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-01 20:23+0000\n"
|
||||
"POT-Creation-Date: 2017-03-04 04:00+0000\n"
|
||||
"PO-Revision-Date: 2017-03-01 21:25+0100\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: Raphael Michel <michel@rami.io>\n"
|
||||
@@ -5879,8 +5879,9 @@ msgid "The selected voucher has been deleted."
|
||||
msgstr "Der ausgewählte Gutschein wurde gelöscht."
|
||||
|
||||
#: pretix/control/views/vouchers.py:218
|
||||
msgid "The new voucher has been created."
|
||||
msgstr "Der neue Gutschein wurde erstellt."
|
||||
#, fuzzy, python-brace-format
|
||||
msgid "The new voucher has been created: {code}"
|
||||
msgstr "Der neue Gutschein wurde erstellt: {code}"
|
||||
|
||||
#: pretix/control/views/vouchers.py:250
|
||||
msgid "The new vouchers have been created."
|
||||
@@ -7751,15 +7752,15 @@ msgstr ""
|
||||
"Wir haben dich zur Warteliste hinzugefügt. Du erhälst eine E-Mail, sobald "
|
||||
"wieder Tickets verfügbar sind."
|
||||
|
||||
#: pretix/settings.py:281
|
||||
#: pretix/settings.py:284
|
||||
msgid "English"
|
||||
msgstr "Englisch"
|
||||
|
||||
#: pretix/settings.py:282
|
||||
#: pretix/settings.py:285
|
||||
msgid "German"
|
||||
msgstr "Deutsch"
|
||||
|
||||
#: pretix/settings.py:283
|
||||
#: pretix/settings.py:286
|
||||
msgid "German (informal)"
|
||||
msgstr "Deutsch (Du)"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-01 20:23+0000\n"
|
||||
"POT-Creation-Date: 2017-03-04 04:00+0000\n"
|
||||
"PO-Revision-Date: 2017-01-18 09:42+0100\n"
|
||||
"Last-Translator: Raphael Michel <michel@rami.io>\n"
|
||||
"Language-Team: \n"
|
||||
|
||||
@@ -133,6 +133,18 @@ class VoucherFormTest(SoupTest):
|
||||
assert len(codes) == 7
|
||||
assert all([len(r) == 16 for r in codes])
|
||||
|
||||
def test_display_voucher_code(self):
|
||||
count_before = self.event.vouchers.count()
|
||||
doc = self.get_doc('/control/event/%s/%s/vouchers/add' % (self.orga.slug, self.event.slug))
|
||||
form_data = extract_form_fields(doc.select('.container-fluid form')[0])
|
||||
form_data.update({
|
||||
'itemvar': '%d' % self.ticket.pk
|
||||
})
|
||||
doc = self.post_doc('/control/event/%s/%s/vouchers/add' % (self.orga.slug, self.event.slug), form_data)
|
||||
v = Voucher.objects.latest('pk')
|
||||
assert v.code in doc.select(".alert-success")[0].text
|
||||
assert count_before + 1 == self.event.vouchers.count()
|
||||
|
||||
def test_create_non_blocking_item_voucher(self):
|
||||
self._create_voucher({
|
||||
'itemvar': '%d' % self.ticket.pk
|
||||
|
||||
Reference in New Issue
Block a user