Commit a8c149c4 authored by Bram in 't Zandt's avatar Bram in 't Zandt
Browse files

Header fields in event export are now being translated.

parent c2c38d9e
...@@ -56,60 +56,61 @@ def change_registration(request, event_id, action=None): ...@@ -56,60 +56,61 @@ def change_registration(request, event_id, action=None):
@staff_member_required @staff_member_required
@permission_required('events.change_event') @permission_required('events.change_event')
@organiser_only
def export(request, event_id): def export(request, event_id):
event = get_object_or_404(Event, pk=event_id) event = get_object_or_404(Event, pk=event_id)
extra_fields = event.registrationinformationfield_set.all() extra_fields = event.registrationinformationfield_set.all()
registrations = event.registration_set.all() registrations = event.registration_set.all()
header_fields = ( header_fields = (
['name', 'email', 'paid', 'present', [_('Name'), _('Email'), _('Paid'), _('Present'),
'status', 'phone number'] + _('Status'), _('Phone number')] +
[field.name for field in extra_fields] + [field.name for field in extra_fields] +
['date', 'date cancelled']) [_('Date'), _('Date cancelled')])
rows = [] rows = []
if event.price == 0: if event.price == 0:
header_fields.remove('paid') header_fields.remove(_('Paid'))
for i, registration in enumerate(registrations): for i, registration in enumerate(registrations):
if registration.member: if registration.member:
name = registration.member.get_full_name() name = registration.member.get_full_name()
else: else:
name = registration.name name = registration.name
status = pgettext_lazy('registration status', 'registered') status = pgettext_lazy('registration status',
'registered').capitalize()
cancelled = None cancelled = None
if registration.date_cancelled: if registration.date_cancelled:
if registration.is_late_cancellation(): if registration.is_late_cancellation():
status = pgettext_lazy('registration status', status = pgettext_lazy('registration status',
'late cancellation') 'late cancellation').capitalize()
else: else:
status = pgettext_lazy('registration status', 'cancelled') status = pgettext_lazy('registration status',
'cancelled').capitalize()
cancelled = timezone.localtime(registration.date_cancelled) cancelled = timezone.localtime(registration.date_cancelled)
elif registration.queue_position: elif registration.queue_position:
status = pgettext_lazy('registration status', 'waiting') status = pgettext_lazy('registration status', 'waiting')
data = { data = {
'name': name, _('Name'): name,
'date': timezone.localtime(registration.date _('Date'): timezone.localtime(
).strftime("%Y-%m-%d %H:%m"), registration.date).strftime("%Y-%m-%d %H:%m"),
'present': _('Yes') if registration.present else '', _('Present'): _('Yes') if registration.present else '',
'phone number': (registration.member.phone_number _('Phone number'): (registration.member.phone_number
if registration.member if registration.member
else ''), else ''),
'email': (registration.member.user.email _('Email'): (registration.member.user.email
if registration.member if registration.member
else ''), else ''),
'status': status, _('Status'): status,
'date cancelled': cancelled, _('Date cancelled'): cancelled,
} }
if event.price > 0: if event.price > 0:
if registration.payment == Registration.PAYMENT_CASH: if registration.payment == 'cash_payment':
data['paid'] = _('Cash') data[_('Paid')] = _('Cash')
elif registration.payment == Registration.PAYMENT_CARD: elif registration.payment == 'pin_payment':
data['paid'] = _('Card') data[_('Paid')] = _('Pin')
else: else:
data['paid'] = _('No') data[_('Paid')] = _('No')
data.update({field['field'].name: field['value'] for field in data.update({field['field'].name: field['value'] for field in
registration.information_fields}) registration.information_fields})
...@@ -121,9 +122,10 @@ def export(request, event_id): ...@@ -121,9 +122,10 @@ def export(request, event_id):
rows = sorted(rows, rows = sorted(rows,
key=lambda row: key=lambda row:
(row['status'] == pgettext_lazy('registration status', (row[_('Status')] == pgettext_lazy(
'late cancellation'), 'registration status',
row['date']), 'late cancellation').capitalize(),
row[_('Date')]),
reverse=True, reverse=True,
) )
......
...@@ -7,8 +7,8 @@ msgid "" ...@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-23 13:33+0200\n" "POT-Creation-Date: 2017-09-27 19:58+0200\n"
"PO-Revision-Date: 2017-09-23 13:35+0200\n" "PO-Revision-Date: 2017-09-27 19:59+0200\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n" "Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
...@@ -16,7 +16,7 @@ msgstr "" ...@@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.4\n" "X-Generator: Poedit 2.0.3\n"
#: admin.py:86 #: admin.py:86
msgid "Event Date" msgid "Event Date"
...@@ -42,39 +42,72 @@ msgstr "Publiceer geselecteerde evenementen" ...@@ -42,39 +42,72 @@ msgstr "Publiceer geselecteerde evenementen"
msgid "Unpublish selected events" msgid "Unpublish selected events"
msgstr "Publicatie van geselecteerde evenementen ongedaan maken" msgstr "Publicatie van geselecteerde evenementen ongedaan maken"
#: admin_views.py:65 admin_views.py:94
msgid "Name"
msgstr "Naam"
#: admin_views.py:65 admin_views.py:101
msgid "Email"
msgstr "E-mail"
#: admin_views.py:65 admin_views.py:72 admin_views.py:109 admin_views.py:111
#: admin_views.py:113
msgid "Paid"
msgstr "Betaald"
#: admin_views.py:65 admin_views.py:97
msgid "Present"
msgstr "Aanwezig"
#: admin_views.py:66 admin_views.py:104 admin_views.py:125
msgid "Status"
msgstr "Status"
#: admin_views.py:66 admin_views.py:98
msgid "Phone number"
msgstr "Telefoonnummer"
#: admin_views.py:68 admin_views.py:95 admin_views.py:128
msgid "Date"
msgstr "Datum"
#: admin_views.py:68 admin_views.py:105
msgid "Date cancelled"
msgstr "Afmelddatum"
#: admin_views.py:79 #: admin_views.py:79
msgctxt "registration status" msgctxt "registration status"
msgid "registered" msgid "registered"
msgstr "aangemeld" msgstr "aangemeld"
#: admin_views.py:85 admin_views.py:125 #: admin_views.py:85 admin_views.py:127
msgctxt "registration status" msgctxt "registration status"
msgid "late cancellation" msgid "late cancellation"
msgstr "te laat afgemeld" msgstr "te laat afgemeld"
#: admin_views.py:87 #: admin_views.py:88
msgctxt "registration status" msgctxt "registration status"
msgid "cancelled" msgid "cancelled"
msgstr "afgemeld" msgstr "afgemeld"
#: admin_views.py:91 #: admin_views.py:92
msgctxt "registration status" msgctxt "registration status"
msgid "waiting" msgid "waiting"
msgstr "wachtend" msgstr "wachtend"
#: admin_views.py:96 #: admin_views.py:97
msgid "Yes" msgid "Yes"
msgstr "Ja" msgstr "Ja"
#: admin_views.py:108 #: admin_views.py:109
msgid "Cash" msgid "Cash"
msgstr "Contant" msgstr "Contant"
#: admin_views.py:110 #: admin_views.py:111
msgid "Card" msgid "Pin"
msgstr "Pin" msgstr "Pin"
#: admin_views.py:112 #: admin_views.py:113
msgid "No" msgid "No"
msgstr "Nee" msgstr "Nee"
...@@ -690,7 +723,7 @@ msgstr "Je afmelding was succesvol." ...@@ -690,7 +723,7 @@ msgstr "Je afmelding was succesvol."
msgid "Registration successfully saved." msgid "Registration successfully saved."
msgstr "Je afmelding is succesvol opgeslagen." msgstr "Je afmelding is succesvol opgeslagen."
#~ msgid "Pin" #~ msgid "Card"
#~ msgstr "Pin" #~ msgstr "Pin"
#~ msgid "You may not register" #~ msgid "You may not register"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment