Skip to content

Commit 94d9fb8

Browse files
ercastasandrobonazzola
authored andcommitted
Ticket import fix dup participant (CoderDojoBrianza#13)
* Implemented ticket import from csv file * Fixed participant duplication (matching by name did not work). Added GenericUserFile in admin interface
1 parent ebf9eeb commit 94d9fb8

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

admin.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ class LiberatoriaOption(admin.ModelAdmin):
3434
admin.site.register(models.SoftwareTool)
3535
admin.site.register(models.LearningTopic)
3636
admin.site.register(models.Waiver)
37+
admin.site.register(models.GenericUserFile)

locale/en/LC_MESSAGES/django.po

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ msgstr "Ticket not found!"
127127

128128
#: .\coderdojomobile\templates\coderdojomobile\eventCheckInOut.html:39
129129
#: .\coderdojomobile\templates\coderdojomobile\eventTicketUpload.html:33
130+
#: .\coderdojomobile\templates\coderdojomobile\eventTicketUpload.html:28
130131
msgid "Back to the event"
131132
msgstr ""
132133

@@ -150,6 +151,7 @@ msgstr "Participant List"
150151

151152
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:63
152153
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:77
154+
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:70
153155
msgid "Confirm"
154156
msgstr ""
155157

locale/it/LC_MESSAGES/django.po

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ msgstr "Biglietto non trovato!"
131131

132132
#: .\coderdojomobile\templates\coderdojomobile\eventCheckInOut.html:39
133133
#: .\coderdojomobile\templates\coderdojomobile\eventTicketUpload.html:33
134+
#: .\coderdojomobile\templates\coderdojomobile\eventTicketUpload.html:28
134135
msgid "Back to the event"
135136
msgstr "Torna all'evento"
136137

@@ -154,6 +155,7 @@ msgstr "Lista Partecipanti"
154155

155156
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:63
156157
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:77
158+
#: .\coderdojomobile\templates\coderdojomobile\eventDetails.html:70
157159
msgid "Confirm"
158160
msgstr "Conferma"
159161

views.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,14 @@ def import_ticket(ticket, event):
498498
participant = Participant.objects.get(uuid=badge_id)
499499
except Participant.DoesNotExist:
500500
pass
501-
if badge_id is None and name is not None and surname is not None \
502-
and len(name) and len(surname) > 0:
501+
elif name is not None and surname is not None \
502+
and len(name) > 0 and len(surname) > 0:
503503
# Look for the Participant
504504
try:
505-
participant = Participant.objects.get(name=name, surname=surname)
505+
participant = Participant.objects.get(
506+
name__iexact=name,
507+
surname__iexact=surname
508+
)
506509
except Participant.DoesNotExist:
507510
pass
508511
except Participant.MultipleObjectsReturned:

0 commit comments

Comments
 (0)