Commit 7bfde2f1 authored by Tom van Bussel's avatar Tom van Bussel
Browse files

Merge branch 'fix/card-export-event' into 'master'

Fix payment status export and AJAX changes

See merge request !580
parents 2f8ad4e1 1f5fa651
...@@ -37,14 +37,17 @@ def change_registration(request, event_id, action=None): ...@@ -37,14 +37,17 @@ def change_registration(request, event_id, action=None):
try: try:
id = request.POST.get("id", -1) id = request.POST.get("id", -1)
checked = json.loads(request.POST.get("checked"))
obj = Registration.objects.get(event=event_id, pk=id) obj = Registration.objects.get(event=event_id, pk=id)
if checked is not None: if action == 'present':
if action == 'present': checked = json.loads(request.POST.get("checked"))
if checked is not None:
obj.present = checked obj.present = checked
elif action == 'paid': obj.save()
obj.paid = checked elif action == 'payment':
obj.save() value = request.POST.get("value")
if value is not None:
obj.payment = value
obj.save()
except Registration.DoesNotExist: except Registration.DoesNotExist:
data['success'] = False data['success'] = False
...@@ -101,10 +104,10 @@ def export(request, event_id): ...@@ -101,10 +104,10 @@ def export(request, event_id):
'date cancelled': cancelled, 'date cancelled': cancelled,
} }
if event.price > 0: if event.price > 0:
if registration.payment == 'cash_payment': if registration.payment == Registration.PAYMENT_CASH:
data['paid'] = _('Cash') data['paid'] = _('Cash')
elif registration.payment == 'pin_payment': elif registration.payment == Registration.PAYMENT_CARD:
data['paid'] = _('Pin') data['paid'] = _('Card')
else: else:
data['paid'] = _('No') data['paid'] = _('No')
...@@ -161,6 +164,6 @@ def all_present(request, event_id): ...@@ -161,6 +164,6 @@ def all_present(request, event_id):
.order_by('date')[:event.max_participants]) .order_by('date')[:event.max_participants])
event.registration_set.filter(pk__in=registrations_query).update( event.registration_set.filter(pk__in=registrations_query).update(
present=True, payment='cash_payment') present=True, payment=Registration.PAYMENT_CASH)
return HttpResponseRedirect('/events/admin/{}'.format(event_id)) return HttpResponseRedirect('/events/admin/{}'.format(event_id))
...@@ -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-17 18:07+0200\n" "POT-Creation-Date: 2017-09-22 14:54+0200\n"
"PO-Revision-Date: 2017-09-17 18:07+0200\n" "PO-Revision-Date: 2017-09-22 14:54+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"
...@@ -42,39 +42,39 @@ msgstr "Publiceer geselecteerde evenementen" ...@@ -42,39 +42,39 @@ 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:76 #: admin_views.py:79
msgctxt "registration status" msgctxt "registration status"
msgid "registered" msgid "registered"
msgstr "aangemeld" msgstr "aangemeld"
#: admin_views.py:82 admin_views.py:122 #: admin_views.py:85 admin_views.py:125
msgctxt "registration status" msgctxt "registration status"
msgid "late cancellation" msgid "late cancellation"
msgstr "te laat afgemeld" msgstr "te laat afgemeld"
#: admin_views.py:84 #: admin_views.py:87
msgctxt "registration status" msgctxt "registration status"
msgid "cancelled" msgid "cancelled"
msgstr "afgemeld" msgstr "afgemeld"
#: admin_views.py:88 #: admin_views.py:91
msgctxt "registration status" msgctxt "registration status"
msgid "waiting" msgid "waiting"
msgstr "wachtend" msgstr "wachtend"
#: admin_views.py:93 #: admin_views.py:96
msgid "Yes" msgid "Yes"
msgstr "Ja" msgstr "Ja"
#: admin_views.py:105 #: admin_views.py:108
msgid "Cash" msgid "Cash"
msgstr "Contant" msgstr "Contant"
#: admin_views.py:107 #: admin_views.py:110
msgid "Pin" msgid "Card"
msgstr "Pin" msgstr "Pin"
#: admin_views.py:109 #: admin_views.py:112
msgid "No" msgid "No"
msgstr "Nee" msgstr "Nee"
...@@ -114,39 +114,39 @@ msgstr "Workshop" ...@@ -114,39 +114,39 @@ msgstr "Workshop"
msgid "Other" msgid "Other"
msgstr "Overig" msgstr "Overig"
#: models.py:33 templates/events/event.html:140 #: models.py:26 templates/events/event.html:136
msgid "No registration required" msgid "No registration required"
msgstr "Geen aanmelding vereist" msgstr "Geen aanmelding vereist"
#: models.py:37 templates/events/admin/details.html:68 #: models.py:30 templates/events/admin/details.html:68
msgid "title" msgid "title"
msgstr "titel" msgstr "titel"
#: models.py:43 models.py:388 #: models.py:36 models.py:384
msgid "description" msgid "description"
msgstr "beschrijving" msgstr "beschrijving"
#: models.py:46 #: models.py:39
msgid "start time" msgid "start time"
msgstr "starttijd" msgstr "starttijd"
#: models.py:48 #: models.py:41
msgid "end time" msgid "end time"
msgstr "eindtijd" msgstr "eindtijd"
#: models.py:53 templates/events/admin/details.html:72 #: models.py:46 templates/events/admin/details.html:72
msgid "organiser" msgid "organiser"
msgstr "organisator" msgstr "organisator"
#: models.py:59 #: models.py:52
msgid "category" msgid "category"
msgstr "categorie" msgstr "categorie"
#: models.py:64 #: models.py:57
msgid "registration start" msgid "registration start"
msgstr "start aanmelden" msgstr "start aanmelden"
#: models.py:67 models.py:76 #: models.py:60 models.py:69
msgid "" msgid ""
"If you set a registration period registration will be required. If you don't " "If you set a registration period registration will be required. If you don't "
"set one, registration won't be required." "set one, registration won't be required."
...@@ -154,24 +154,24 @@ msgstr "" ...@@ -154,24 +154,24 @@ msgstr ""
"Als je een aanmeldperiode instelt is aanmelden vereist, als je dat niet doet " "Als je een aanmeldperiode instelt is aanmelden vereist, als je dat niet doet "
"is aanmelden niet vereist." "is aanmelden niet vereist."
#: models.py:73 #: models.py:66
msgid "registration end" msgid "registration end"
msgstr "einde aanmelden" msgstr "einde aanmelden"
#: models.py:82 #: models.py:75
msgid "cancel deadline" msgid "cancel deadline"
msgstr "afmelddeadline" msgstr "afmelddeadline"
#: models.py:89 templates/events/admin/details.html:76 #: models.py:82 templates/events/admin/details.html:76
#: templates/events/event.html:38 #: templates/events/event.html:38
msgid "location" msgid "location"
msgstr "locatie" msgstr "locatie"
#: models.py:94 #: models.py:87
msgid "location for minimap" msgid "location for minimap"
msgstr "locatie voor minimap" msgstr "locatie voor minimap"
#: models.py:96 #: models.py:89
msgid "" msgid ""
"Location of Huygens: Heyendaalseweg 135, Nijmegen. Location of Mercator 1: " "Location of Huygens: Heyendaalseweg 135, Nijmegen. Location of Mercator 1: "
"Toernooiveld 212, Nijmegen. Not shown as text!!" "Toernooiveld 212, Nijmegen. Not shown as text!!"
...@@ -179,156 +179,156 @@ msgstr "" ...@@ -179,156 +179,156 @@ msgstr ""
"Locatie van ’t Huygens: Heyendaalseweg 135, Nijmegen. Locatie van Mercator " "Locatie van ’t Huygens: Heyendaalseweg 135, Nijmegen. Locatie van Mercator "
"1: Toernooiveld 212, Nijmegen. Dit veld wordt niet getoond als tekst!!" "1: Toernooiveld 212, Nijmegen. Dit veld wordt niet getoond als tekst!!"
#: models.py:102 templates/events/admin/details.html:78 #: models.py:95 templates/events/admin/details.html:78
#: templates/events/event.html:43 #: templates/events/event.html:43
msgid "price" msgid "price"
msgstr "prijs" msgstr "prijs"
#: models.py:110 #: models.py:103
msgid "fine" msgid "fine"
msgstr "boete" msgstr "boete"
#: models.py:116 #: models.py:109
msgid "Fine if participant does not show up (at least €5)." msgid "Fine if participant does not show up (at least €5)."
msgstr "Boete als deelnemer niet komt opdagen (minimaal €5)." msgstr "Boete als deelnemer niet komt opdagen (minimaal €5)."
#: models.py:121 #: models.py:114
msgid "maximum number of participants" msgid "maximum number of participants"
msgstr "maximum aantal deelnemers" msgstr "maximum aantal deelnemers"
#: models.py:128 #: models.py:121
msgid "message when there is no registration" msgid "message when there is no registration"
msgstr "bericht dat getoond wordt wanneer aanmelden niet nodig is" msgstr "bericht dat getoond wordt wanneer aanmelden niet nodig is"
#: models.py:132 #: models.py:125
msgid "Default:" msgid "Default:"
msgstr "Standaard:" msgstr "Standaard:"
#: models.py:136 #: models.py:129
msgid "published" msgid "published"
msgstr "gepubliceerd" msgstr "gepubliceerd"
#: models.py:193 #: models.py:185
msgid "Can't have an event travel back in time" msgid "Can't have an event travel back in time"
msgstr "Een evenement kan niet terugreizen in de tijd" msgstr "Een evenement kan niet terugreizen in de tijd"
#: models.py:197 #: models.py:189
msgid "The fine for this event is too low (must be at least €5)." msgid "The fine for this event is too low (must be at least €5)."
msgstr "De boete voor dit evenement is te laag (minimaal €5)." msgstr "De boete voor dit evenement is te laag (minimaal €5)."
#: models.py:204 #: models.py:196
msgid "Doesn't make sense to have this if you require registrations." msgid "Doesn't make sense to have this if you require registrations."
msgstr "Het is niet logisch om dit te hebben als je aanmelden vereist." msgstr "Het is niet logisch om dit te hebben als je aanmelden vereist."
#: models.py:209 #: models.py:201
msgid "If registration is required, you need a start of registration" msgid "If registration is required, you need a start of registration"
msgstr "" msgstr ""
"Als aanmelden vereist is, dan heb je een starttijd voor de aanmeldperiode " "Als aanmelden vereist is, dan heb je een starttijd voor de aanmeldperiode "
"nodig" "nodig"
#: models.py:214 #: models.py:206
msgid "If registration is required, you need an end of registration" msgid "If registration is required, you need an end of registration"
msgstr "" msgstr ""
"Als aanmelden vereist is, dan heb je een eindtijd voor de aanmeldperiode " "Als aanmelden vereist is, dan heb je een eindtijd voor de aanmeldperiode "
"nodig" "nodig"
#: models.py:219 #: models.py:211
msgid "If registration is required, you need a deadline for the cancellation" msgid "If registration is required, you need a deadline for the cancellation"
msgstr "" msgstr ""
"Als aanmelden vereist is, dan heb je een eindtijd voor de aanmeldperiode " "Als aanmelden vereist is, dan heb je een eindtijd voor de aanmeldperiode "
"nodig" "nodig"
#: models.py:224 #: models.py:216
msgid "The cancel deadline should be before the start of the event." msgid "The cancel deadline should be before the start of the event."
msgstr "De afmelddeadline moet voor de start van het evenement liggen." msgstr "De afmelddeadline moet voor de start van het evenement liggen."
#: models.py:228 #: models.py:220
msgid "Registration start should be before registration end" msgid "Registration start should be before registration end"
msgstr "De starttijd voor de aanmeldperiode moet voor de eindtijd liggen" msgstr "De starttijd voor de aanmeldperiode moet voor de eindtijd liggen"
#: models.py:255 #: models.py:251
msgid "No payment" msgid "No payment"
msgstr "Niet betaald" msgstr "Niet betaald"
#: models.py:256 #: models.py:252
msgid "Paid with cash" msgid "Paid with cash"
msgstr "Contact betaald" msgstr "Contact betaald"
#: models.py:257 #: models.py:253
msgid "Paid with card" msgid "Paid with card"
msgstr "Pin betaald" msgstr "Pin betaald"
#: models.py:270 templates/events/admin/registrations_table.html:6 #: models.py:266 templates/events/admin/registrations_table.html:6
msgid "name" msgid "name"
msgstr "naam" msgstr "naam"
#: models.py:272 #: models.py:268
msgid "Use this for non-members" msgid "Use this for non-members"
msgstr "Gebruikt dit voor niet-leden" msgstr "Gebruikt dit voor niet-leden"
#: models.py:277 #: models.py:273
msgid "registration date" msgid "registration date"
msgstr "aanmelddatum" msgstr "aanmelddatum"
#: models.py:279 #: models.py:275
msgid "cancellation date" msgid "cancellation date"
msgstr "afmelddatum" msgstr "afmelddatum"
#: models.py:284 templates/events/admin/registrations_table.html:11 #: models.py:280 templates/events/admin/registrations_table.html:11
msgid "present" msgid "present"
msgstr "aanwezig" msgstr "aanwezig"
#: models.py:291 #: models.py:287
msgid "payment" msgid "payment"
msgstr "betaling" msgstr "betaling"
#: models.py:344 models.py:345 #: models.py:340 models.py:341
msgid "Either specify a member or a name" msgid "Either specify a member or a name"
msgstr "Geef een lid of een naam op" msgstr "Geef een lid of een naam op"
#: models.py:368 #: models.py:364
msgid "Checkbox" msgid "Checkbox"
msgstr "Checkbox" msgstr "Checkbox"
#: models.py:369 #: models.py:365
msgid "Text" msgid "Text"
msgstr "Text" msgstr "Text"
#: models.py:370 #: models.py:366
msgid "Integer" msgid "Integer"
msgstr "Integer" msgstr "Integer"
#: models.py:375 #: models.py:371
msgid "field type" msgid "field type"
msgstr "veldtype" msgstr "veldtype"
#: models.py:382 #: models.py:378
msgid "field name" msgid "field name"
msgstr "veldnaam" msgstr "veldnaam"
#: models.py:394 #: models.py:390
msgid "required" msgid "required"
msgstr "verplicht" msgstr "verplicht"
#: models.py:446 #: models.py:442
msgid "last changed" msgid "last changed"
msgstr "laatst aangepast" msgstr "laatst aangepast"
#: services.py:91 #: services.py:81
msgid "" msgid ""
"You cannot re-register anymore since you've cancelled after the deadline." "You cannot re-register anymore since you've cancelled after the deadline."
msgstr "" msgstr ""
"Je kunt je niet opnieuw aanmelden omdat je je hebt afgemeld na de deadline." "Je kunt je niet opnieuw aanmelden omdat je je hebt afgemeld na de deadline."
#: services.py:101 #: services.py:91
msgid "You were already registered." msgid "You were already registered."
msgstr "Je bent al aangemeld." msgstr "Je bent al aangemeld."
#: services.py:103 #: services.py:93
msgid "You may not register." msgid "You may not register."
msgstr "Je mag je niet aanmelden." msgstr "Je mag je niet aanmelden."
#: services.py:123 services.py:143 services.py:171 #: services.py:117 services.py:131 services.py:182
msgid "You are not registered for this event." msgid "You are not registered for this event."
msgstr "Je bent niet aangemeld voor dit evenement." msgstr "Je bent niet aangemeld voor dit evenement."
...@@ -601,16 +601,16 @@ msgstr "Login" ...@@ -601,16 +601,16 @@ msgstr "Login"
msgid "You have to log in before you can register for this event." msgid "You have to log in before you can register for this event."
msgstr "Je moet inloggen voordat je jezelf kunt aanmelden." msgstr "Je moet inloggen voordat je jezelf kunt aanmelden."
#: templates/events/event.html:133 #: templates/events/event.html:139
#, python-format #, python-format
msgid "Registration will open %(datetime)s" msgid "Registration will open %(datetime)s"
msgstr "Aanmelden opent %(datetime)s" msgstr "Aanmelden opent %(datetime)s"
#: templates/events/event.html:135 #: templates/events/event.html:141
msgid "Registration is not possible anymore." msgid "Registration is not possible anymore."
msgstr "Aanmelden is niet meer mogelijk." msgstr "Aanmelden is niet meer mogelijk."
#: templates/events/event.html:145 #: templates/events/event.html:144
#, python-format #, python-format
msgid "" msgid ""
"Cancellation isn't possible anymore without having to pay the full costs of €" "Cancellation isn't possible anymore without having to pay the full costs of €"
...@@ -619,16 +619,16 @@ msgstr "" ...@@ -619,16 +619,16 @@ msgstr ""
"Afmelden is niet meer mogelijk zonder de volledige kosten van €%(costs)s te " "Afmelden is niet meer mogelijk zonder de volledige kosten van €%(costs)s te "
"betalen. Let op: je kunt je hierna niet meer aanmelden." "betalen. Let op: je kunt je hierna niet meer aanmelden."
#: templates/events/event.html:160 #: templates/events/event.html:158
msgctxt "pizzas" msgctxt "pizzas"
msgid "Order" msgid "Order"
msgstr "Bestellen" msgstr "Bestellen"
#: templates/events/event.html:178 #: templates/events/event.html:176
msgid "Registrations" msgid "Registrations"
msgstr "Aanmeldingen" msgstr "Aanmeldingen"
#: templates/events/event.html:212 #: templates/events/event.html:210
msgid "cohort" msgid "cohort"
msgstr "cohort" msgstr "cohort"
...@@ -674,5 +674,8 @@ msgstr "Je afmelding was succesvol." ...@@ -674,5 +674,8 @@ 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"
#~ msgstr "Pin"
#~ msgid "You may not register" #~ msgid "You may not register"
#~ msgstr "Je mag niet je aanmelden" #~ msgstr "Je mag niet je aanmelden"
...@@ -243,10 +243,14 @@ class Event(models.Model, metaclass=ModelTranslateMeta): ...@@ -243,10 +243,14 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
class Registration(models.Model): class Registration(models.Model):
"""Event registrations""" """Event registrations"""
PAYMENT_CARD = 'card_payment'
PAYMENT_CASH = 'cash_payment'
PAYMENT_NONE = 'no_payment'
PAYMENT_TYPES = ( PAYMENT_TYPES = (
('no_payment', _('No payment')), (PAYMENT_NONE, _('No payment')),
('cash_payment', _('Paid with cash')), (PAYMENT_CASH, _('Paid with cash')),