Fix unicode error on registration types in cross emails
authorMagnus Hagander <magnus@hagander.net>
Sat, 17 Nov 2018 15:52:18 +0000 (16:52 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sat, 17 Nov 2018 15:52:18 +0000 (16:52 +0100)
When a registration type itself had a non-ascii character in it the API
used to populate the dropdown of exclude options would crash...

postgresqleu/confreg/views.py

index 3387b10b8cfa62dde9f518eae86c50dd4709310f..7e0b10db550bf17c6297211da13018c2a7ecba74 100644 (file)
@@ -3210,14 +3210,14 @@ def crossmailoptions(request):
                {'id': 'rt:*', 'title': 'Reg: all'},
        ]
        r.extend([
-               {'id': 'rt:{0}'.format(rt.id), 'title': 'Reg: {0}'.format(rt.regtype)}
+               {'id': 'rt:{0}'.format(rt.id), 'title': u'Reg: {0}'.format(rt.regtype)}
                for rt in RegistrationType.objects.filter(conference=conf)])
        r.extend([
                {'id': 'sp:*', 'title': 'Speaker: all'},
                {'id': 'sp:?', 'title': 'Speaker: accept+reserve'},
        ])
        r.extend([
-               {'id': 'sp:{0}'.format(k), 'title': 'Speaker: {0}'.format(v)}
+               {'id': 'sp:{0}'.format(k), 'title': u'Speaker: {0}'.format(v)}
                for k,v in STATUS_CHOICES
        ])
        return HttpResponse(json.dumps(r), content_type="application/json")