diff --git a/CHANGELOG b/CHANGELOG index 188b00ed3..8e28b5e64 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,12 @@ Version 1.6.1 (unreleased) ========================== [https://github.com/OpenSlides/OpenSlides/issues?milestone=16] +Participants: +- Fixed participant csv import for group id: + * Allowed to add multiple groups in csv group id field, e.g. "3,4". + * Fixed bug that group ids > 9 can not be imported. + * Updated error message if group id does not exists. + Other: - Fixed CKEditor stuff (added insertpre plugin and removed unused code) diff --git a/extras/csv-examples/participants-demo_de.csv b/extras/csv-examples/participants-demo_de.csv index 6b05c0562..d50b9fdc1 100644 --- a/extras/csv-examples/participants-demo_de.csv +++ b/extras/csv-examples/participants-demo_de.csv @@ -13,7 +13,7 @@ Teilnehmer/innen-Namen aus http://de.wikipedia.org/wiki/Otto_Normalverbraucher"; ;"Tädi";"Maali";"female";;3;"Estland";;;;1 ;"Maija";"Maikäläinen";"female";;3;"Finnland";;;;1 ;"Jean";"Dupont";"male";;3;"Frankreich";;;;1 -;"Paul";"Martin";"female";;4;"Frankreich";"Versammlungsleitung";;;1 +;"Paul";"Martin";"male";;"3,4";"Frankreich";"Versammlungsleitung";;;1 ;"Fred";"Bloggs";"male";;3;"Großbritanien";;;;0 ;"John";"Smith";"male";;4;"Großbritanien";"Versammlungsleitung";;;1 ;"Ashok";"Kumar";"male";;3;"Indien";;;;1 diff --git a/openslides/participant/csv_import.py b/openslides/participant/csv_import.py index 55c16c2c4..73bf403c0 100644 --- a/openslides/participant/csv_import.py +++ b/openslides/participant/csv_import.py @@ -54,15 +54,13 @@ def import_users(csvfile): user.is_active = False user.default_password = gen_password() user.save() - for groupid in groups: + for groupid in groups.split(','): try: - if groupid != ",": + if groupid and int(groupid): Group.objects.get(pk=groupid).user_set.add(user) - except ValueError: - error_messages.append(_('Ignoring malformed group id in line %d.') % (line_no + 1)) - continue - except Group.DoesNotExist: - error_messages.append(_('Group id %(id)s does not exists (line %(line)d).') % {'id': groupid, 'line': line_no + 1}) + except (Group.DoesNotExist, ValueError): + error_messages.append(_('Ignoring group id "%(id)s" in line %(line)d which does not exist.') % + {'id': groupid, 'line': line_no + 1}) continue user.reset_password() count_success += 1