Merge pull request #50 from Shirk/master

Fix #419
This commit is contained in:
Oskar Hahn 2012-11-22 04:19:29 -08:00
commit 48b0966a8f
5 changed files with 188 additions and 104 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenSlides 1.x\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-21 21:43+0100\n"
"POT-Creation-Date: 2012-11-22 10:22+0100\n"
"PO-Revision-Date: 2012-07-28 11:07+0200\n"
"Last-Translator: Emanuel Schuetze <emanuel@intevation.de>\n"
"Language-Team: support@openslides.de\n"
@ -34,12 +34,12 @@ msgid "Parent item"
msgstr "Elternelement"
#: agenda/models.py:42 config/forms.py:61 motion/forms.py:22
#: motion/models.py:540 motion/templates/motion/view.html:246
#: motion/models.py:545 motion/templates/motion/view.html:246
#: projector/models.py:32
msgid "Title"
msgstr "Titel"
#: agenda/models.py:43 motion/forms.py:23 motion/models.py:541
#: agenda/models.py:43 motion/forms.py:23 motion/models.py:546
#: motion/templates/motion/view.html:247 projector/models.py:33
msgid "Text"
msgstr "Text"
@ -230,8 +230,8 @@ msgstr "Möchten Sie die geänderte Reihenfolge der Einträge speichern?"
#: assignment/views.py:579 assignment/templates/assignment/view.html:168
#: assignment/templates/assignment/view.html:172
#: assignment/templates/projector/Assignment.html:78
#: assignment/templates/projector/Assignment.html:82 motion/models.py:574
#: motion/views.py:804 motion/views.py:855
#: assignment/templates/projector/Assignment.html:82 motion/models.py:579
#: motion/views.py:842 motion/views.py:893
#: motion/templates/motion/view.html:79
#: motion/templates/projector/Motion.html:37 utils/utils.py:53
#: utils/views.py:111
@ -240,8 +240,8 @@ msgstr "Ja"
#: agenda/templates/agenda/overview.html:47 assignment/models.py:301
#: assignment/views.py:580 assignment/templates/assignment/view.html:169
#: assignment/templates/projector/Assignment.html:79 motion/models.py:574
#: motion/views.py:804 motion/views.py:856
#: assignment/templates/projector/Assignment.html:79 motion/models.py:579
#: motion/views.py:842 motion/views.py:894
#: motion/templates/motion/view.html:80
#: motion/templates/projector/Motion.html:38 utils/utils.py:53
#: utils/views.py:111
@ -404,7 +404,7 @@ msgstr "Beschreibung"
msgid "Comment on the ballot paper"
msgstr "Kommentar für den Stimmzettel"
#: assignment/models.py:69 motion/models.py:335
#: assignment/models.py:69 motion/models.py:337
#, python-format
msgid "%s is not a valid status."
msgstr "%s ist kein gültiger Status."
@ -449,7 +449,7 @@ msgstr "Darf selbst für Wahlen kandidieren"
msgid "Can manage assignment"
msgstr "Darf Wahlen verwalten"
#: assignment/models.py:302 motion/models.py:575
#: assignment/models.py:302 motion/models.py:580
msgid "Abstain"
msgstr "Enthaltung"
@ -483,7 +483,7 @@ msgstr "Neue Wahl wurde erfolgreich angelegt."
msgid "Election was successfully modified."
msgstr "Wahl wurde erfolgreich geändert."
#: assignment/views.py:138 motion/views.py:257 motion/views.py:663
#: assignment/views.py:138 motion/views.py:257 motion/views.py:701
#: participant/views.py:506 participant/views.py:529 utils/views.py:225
#: utils/views.py:243 utils/views.py:267
msgid "Please check the form for errors."
@ -585,7 +585,7 @@ msgstr "Wahlen: %s"
msgid "Candidates"
msgstr "Kandidaten/innen"
#: assignment/views.py:412 motion/views.py:797
#: assignment/views.py:412 motion/views.py:835
#: motion/templates/motion/view.html:44
msgid "Vote results"
msgstr "Abstimmungsergebnis"
@ -625,7 +625,7 @@ msgstr "Ungültige Stimmen"
#: assignment/templates/assignment/view.html:202
#: assignment/templates/assignment/view.html:207
#: assignment/templates/projector/Assignment.html:109
#: assignment/templates/projector/Assignment.html:115 motion/views.py:804
#: assignment/templates/projector/Assignment.html:115 motion/views.py:842
#: motion/templates/motion/poll_view.html:35
#: motion/templates/motion/view.html:84
#: motion/templates/projector/Motion.html:42 poll/models.py:76
@ -660,8 +660,8 @@ msgstr[0] "%d verfügbare Posten"
msgstr[1] "%d verfügbare Posten"
#: assignment/views.py:580 assignment/templates/assignment/view.html:170
#: assignment/templates/projector/Assignment.html:80 motion/views.py:804
#: motion/views.py:857 motion/templates/motion/view.html:81
#: assignment/templates/projector/Assignment.html:80 motion/views.py:842
#: motion/views.py:895 motion/templates/motion/view.html:81
#: motion/templates/projector/Motion.html:39
msgid "Abstention"
msgstr "Enthaltung"
@ -722,7 +722,7 @@ msgstr "Wahl-Einstellungen"
#: assignment/templates/assignment/overview.html:14
#: assignment/templates/assignment/overview.html:27
#: assignment/templates/assignment/view.html:11
#: assignment/templates/projector/Assignment.html:18 motion/views.py:775
#: assignment/templates/projector/Assignment.html:18 motion/views.py:813
#: motion/templates/motion/overview.html:20
#: motion/templates/motion/overview.html:40
#: motion/templates/motion/view.html:34
@ -844,7 +844,7 @@ msgid "was not a <br> candidate"
msgstr "war kein Kandidat"
#: assignment/templates/assignment/view.html:191
#: assignment/templates/projector/Assignment.html:100 motion/views.py:804
#: assignment/templates/projector/Assignment.html:100 motion/views.py:842
#: motion/templates/motion/view.html:82
#: motion/templates/projector/Motion.html:40
msgid "Invalid"
@ -904,7 +904,7 @@ msgstr "Allgemein"
#: config/models.py:127 config/templates/config/version.html:5
#: config/templates/config/version.html:8
#: config/templates/config/version.html:11 motion/views.py:789
#: config/templates/config/version.html:11 motion/views.py:827
#: motion/templates/motion/view.html:214 motion/templates/motion/view.html:244
msgid "Version"
msgstr "Version"
@ -942,7 +942,7 @@ msgstr "Willkommens-Widget"
msgid "System"
msgstr "System"
#: motion/forms.py:25 motion/models.py:542 motion/views.py:823
#: motion/forms.py:25 motion/models.py:547 motion/views.py:861
#: motion/templates/motion/view.html:229 motion/templates/motion/view.html:249
#: motion/templates/projector/Motion.html:77
msgid "Reason"
@ -956,14 +956,14 @@ msgstr "Triviale Änderung"
msgid "Trivial changes don't create a new version."
msgstr "Triviale Änderungen erzeugen keine neue Version."
#: motion/forms.py:35 motion/models.py:66 motion/views.py:742
#: motion/forms.py:35 motion/models.py:68 motion/views.py:780
#: motion/templates/motion/overview.html:41
#: motion/templates/motion/view.html:18
#: motion/templates/projector/Motion.html:55
msgid "Submitter"
msgstr "Antragsteller/in"
#: motion/forms.py:44 motion/views.py:762 motion/templates/motion/view.html:22
#: motion/forms.py:44 motion/views.py:800 motion/templates/motion/view.html:22
msgid "Supporters"
msgstr "Unterstützer/innen"
@ -1008,74 +1008,74 @@ msgid "Warning: Trivial changes undermine the motions autorisation system."
msgstr ""
"Warnung: Triviale Änderungen unterlaufen das Zulassungssystem von Anträgen."
#: motion/models.py:45
#: motion/models.py:47
msgid "Published"
msgstr "Veröffentlicht"
#: motion/models.py:46
#: motion/models.py:48
msgid "Permitted"
msgstr "Zugelassen"
#: motion/models.py:47 motion/templates/motion/overview.html:24
#: motion/models.py:49 motion/templates/motion/overview.html:24
#: motion/templates/motion/view.html:167
msgid "Accepted"
msgstr "Angenommen"
#: motion/models.py:48 motion/templates/motion/overview.html:25
#: motion/models.py:50 motion/templates/motion/overview.html:25
#: motion/templates/motion/view.html:172
msgid "Rejected"
msgstr "Abgelehnt"
#: motion/models.py:49
#: motion/models.py:51
msgid "Withdrawed"
msgstr "Zurückgezogen"
#: motion/models.py:50 motion/templates/motion/view.html:180
#: motion/models.py:52 motion/templates/motion/view.html:180
msgid "Adjourned"
msgstr "Vertagt"
# please check!
#: motion/models.py:51 motion/templates/motion/view.html:183
#: motion/models.py:53 motion/templates/motion/view.html:183
msgid "Not Concerned"
msgstr "Nicht befasst"
# please check!
#: motion/models.py:52 motion/templates/motion/view.html:186
#: motion/models.py:54 motion/templates/motion/view.html:186
msgid "Commited a bill"
msgstr "Verwiesen (in Ausschuss)"
#: motion/models.py:53
#: motion/models.py:55
msgid "Rejected (not authorized)"
msgstr "Verworfen (nicht zulässig)"
#: motion/models.py:54 motion/templates/motion/overview.html:27
#: motion/models.py:56 motion/templates/motion/overview.html:27
msgid "Needs Review"
msgstr "Benötigt Review"
#: motion/models.py:103
#: motion/models.py:105
#, python-format
msgid "Version %d authorized"
msgstr "Version %d zugelassen"
#: motion/models.py:110
#: motion/models.py:112
#, python-format
msgctxt "Rejected means not authorized"
msgid "Version %d rejected"
msgstr "Version verworfen"
msgstr "Version %d verworfen"
#: motion/models.py:139
#: motion/models.py:141
msgid "Searching for supporters."
msgstr "Auf Unterstützersuche."
#: motion/models.py:141
#: motion/models.py:143
msgid "Not yet authorized."
msgstr "Noch nicht zugelassen."
#: motion/models.py:143
#: motion/models.py:145
msgid "Not yet authorized changes."
msgstr "Noch nicht zugelassene Änderungen."
#: motion/models.py:223
#: motion/models.py:225
#, python-format
msgid ""
"Trivial changes to version %(version)d; changed fields: %(changed_fields)s"
@ -1083,51 +1083,51 @@ msgstr ""
"Triviale Änderung an Version %(version)d; Geänderte Felder: "
"%(changed_fields)s"
#: motion/models.py:234
#: motion/models.py:236
#, python-format
msgid "Version %s created"
msgstr "Version %s erstellt"
#: motion/models.py:244
#: motion/models.py:246
msgid "Supporters removed"
msgstr "Unterstützer/innen gelöscht"
#: motion/models.py:253
#: motion/models.py:255
#, python-format
msgid "Status reseted to: %s"
msgstr "Status zurückgesetzt auf: %s"
#: motion/models.py:265
#: motion/models.py:267
#, python-format
msgid "Supporter: +%s"
msgstr "Unterstützer/in: +%s"
#: motion/models.py:278
#: motion/models.py:280
#, python-format
msgid "Supporter: -%s"
msgstr "Unterstützer/in: -%s"
#: motion/models.py:295
#: motion/models.py:297
#, python-format
msgid "Number set: %s"
msgstr "Nummer gesetzt: %s"
#: motion/models.py:308
#: motion/models.py:310
#, python-format
msgid "Version %s authorized"
msgstr "Version %s zugelassen"
#: motion/models.py:322
#: motion/models.py:324
#, python-format
msgid "Version %s not authorized"
msgstr "Version %s nicht zugelassen"
#: motion/models.py:338
#: motion/models.py:340
#, python-format
msgid "The motion status is already '%s.'"
msgstr "Der Antragsstatus ist bereits '%s'."
#: motion/models.py:346
#: motion/models.py:348
#, python-format
msgid ""
"The motion status is: '%(currentstatus)s'. You can not set the status to "
@ -1136,15 +1136,15 @@ msgstr ""
"Der Antragsstatus ist: '%(currentstatus)s'. Sie können den Status nicht auf "
"'%(newstatus)s' setzen."
#: motion/models.py:354
#: motion/models.py:356
msgid "Status modified"
msgstr "Status geändert"
#: motion/models.py:446
#: motion/models.py:449 motion/models.py:451
msgid "by"
msgstr "von"
#: motion/models.py:454 motion/templates/motion/view.html:210
#: motion/models.py:459 motion/templates/motion/view.html:210
#: motion/templates/motion/widget.html:27
#: motion/templates/projector/Motion.html:65
#: participant/templates/participant/personal_info_widget.html:13
@ -1152,38 +1152,38 @@ msgstr "von"
msgid "no number"
msgstr "ohne Nummer"
#: motion/models.py:455 motion/templates/motion/widget.html:23
#: motion/models.py:460 motion/templates/motion/widget.html:23
#: participant/templates/participant/personal_info_widget.html:9
#: participant/templates/participant/personal_info_widget.html:28
msgid "motion"
msgstr "Antrag"
#: motion/models.py:480
#: motion/models.py:485
msgid "Poll created"
msgstr "Abstimmung erstellt"
#: motion/models.py:531
#: motion/models.py:536
msgid "Can see motions"
msgstr "Darf Anträge sehen"
#: motion/models.py:532
#: motion/models.py:537
msgid "Can create motions"
msgstr "Darf Anträge erstellen"
#: motion/models.py:533
#: motion/models.py:538
msgid "Can support motions"
msgstr "Darf Anträge unterstützen"
#: motion/models.py:534
#: motion/models.py:539
msgid "Can manage motions"
msgstr "Darf Anträge verwalten"
#: motion/models.py:601
#: motion/models.py:606
msgid "The assembly may decide,"
msgstr "Die Versammlung möge beschließen,"
#: motion/models.py:604 motion/views.py:692 motion/views.py:917
#: motion/views.py:928 motion/templates/motion/base_motion.html:9
#: motion/models.py:609 motion/views.py:730 motion/views.py:955
#: motion/views.py:966 motion/templates/motion/base_motion.html:9
#: motion/templates/motion/overview.html:7
#: motion/templates/motion/overview.html:10
msgid "Motions"
@ -1330,44 +1330,77 @@ msgstr "FEHLER beim Zurückweisen der Version."
msgid "Do you really want to reject version <b>%s</b>?"
msgstr "Soll Version <b>%s</b> wirklich zurückgewiesen werden?"
#: motion/views.py:593 motion/views.py:597 motion/views.py:603
#: motion/views.py:606 participant/api.py:76
#: motion/views.py:599 motion/views.py:603 motion/views.py:609
#: motion/views.py:612 participant/api.py:76
#, python-format
msgid "Ignoring malformed line %d in import file."
msgstr "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert."
#: motion/views.py:649
#: motion/views.py:620
#, python-format
msgid "Ignoring line %d because the assigned group may not act as a person."
msgstr ""
"Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete Gruppe "
"nicht als Person auftreten darf."
#: motion/views.py:629
msgid "Created by motion import."
msgstr "Erstellt durch Antragsimport."
#: motion/views.py:643
#, python-format
msgid ""
"Ignoring line %d because it contains an incomplete first / last name pair."
msgstr ""
"Fehlerhafte Zeile %d der Quelldatei wurde ignoriert, da Vor- bzw. Nachname "
"Leerstrings enthalten."
#: motion/views.py:681
#, python-format
msgid "%d motion was successfully imported."
msgid_plural "%d motions were successfully imported."
msgstr[0] "%d Antrag wurde erfolgreich importiert."
msgstr[1] "%d Anträge wurden erfolgreich importiert."
#: motion/views.py:652
#: motion/views.py:684
#, python-format
msgid "%d motion was successfully modified."
msgid_plural "%d motions were successfully modified."
msgstr[0] "%d Antrag wurde erfolgreich geändert."
msgstr[1] "%d Anträge wurden erfolgreich geändert."
#: motion/views.py:655
#: motion/views.py:687
#, python-format
msgid "%d new user was added."
msgid_plural "%d new users were added."
msgstr[0] "%d neuer Nutzer wurde erstellt."
msgstr[1] "%d neue Nutzer wurden erstellt."
#: motion/views.py:659 participant/api.py:92
#: motion/views.py:690
#, python-format
msgid "%d new group was added."
msgid_plural "%d new groups were added."
msgstr[0] "%d neue Gruppe wurde erstellt."
msgstr[1] "%d neue Gruppen wurden erstellt."
#: motion/views.py:693
#, python-format
msgid "%d group assigned to motions."
msgid_plural "%d groups assigned to motions."
msgstr[0] "%d Gruppe wurde zugewiesen."
msgstr[1] "%d Gruppen wurden zugewiesen."
#: motion/views.py:697 participant/api.py:92
msgid "Import aborted because of severe errors in the input file."
msgstr "Import auf Grund von schweren Fehlern in der Quelldatei abgebrochen."
#: motion/views.py:661 participant/api.py:94
#: motion/views.py:699 participant/api.py:94
msgid "Import file has wrong character encoding, only UTF-8 is supported!"
msgstr ""
"Die Quelldatei benutzt eine ungültige Zeichenkodierung, es wird nur UTF-8 "
"wird unterstützt!"
#: motion/views.py:665
#: motion/views.py:703
msgid ""
"Attention: Existing motions will be modified if you import new motions with "
"the same number."
@ -1375,7 +1408,7 @@ msgstr ""
"Achtung: Existierende Anträge werden geändert wenn Sie neue Anträge mit "
"identischer Nummer importieren."
#: motion/views.py:666
#: motion/views.py:704
msgid ""
"Attention: Importing an motions without a number multiple times will create "
"duplicates."
@ -1383,7 +1416,7 @@ msgstr ""
"Achtung: Bei mehrfachem Import eines Antrags ohne Nummer können Duplikate "
"entstehen."
#: motion/views.py:699 motion/views.py:837
#: motion/views.py:737 motion/views.py:875
#: motion/templates/motion/poll_view.html:7
#: motion/templates/motion/poll_view.html:12
#: motion/templates/motion/view.html:7 motion/templates/motion/view.html:206
@ -1393,21 +1426,21 @@ msgstr ""
msgid "Motion"
msgstr "Antrag"
#: motion/views.py:713 motion/templates/motion/overview.html:84
#: motion/views.py:751 motion/templates/motion/overview.html:84
msgid "No motions available."
msgstr "Keine Anträge vorhanden."
#: motion/views.py:718 motion/views.py:720 motion/views.py:735
#: motion/views.py:737 motion/templates/motion/base_motion.html:24
#: motion/views.py:756 motion/views.py:758 motion/views.py:773
#: motion/views.py:775 motion/templates/motion/base_motion.html:24
#: motion/templates/projector/Motion.html:63
msgid "Motion No."
msgstr "Antrag Nr."
#: motion/views.py:752
#: motion/views.py:790
msgid "Signature"
msgstr "Unterschrift"
#: motion/views.py:803 motion/templates/motion/base_motion.html:55
#: motion/views.py:841 motion/templates/motion/base_motion.html:55
#: motion/templates/motion/poll_view.html:8
#: motion/templates/motion/poll_view.html:13
#: motion/templates/motion/view.html:66 motion/templates/motion/view.html:74
@ -1415,21 +1448,21 @@ msgstr "Unterschrift"
msgid "Vote"
msgstr "Abstimmung"
#: motion/views.py:837
#: motion/views.py:875
msgid "Poll"
msgstr "Abstimmung"
#: motion/views.py:851
#: motion/views.py:889
#, python-format
msgid "Motion No. %s"
msgstr "Antrag Nr. %s"
#: motion/views.py:853
#: motion/views.py:891
#, python-format
msgid "%d. Vote"
msgstr "%d. Abstimmung"
#: motion/views.py:910
#: motion/views.py:948
msgid "Motion settings successfully saved."
msgstr "Antrags-Einstellungen wurden erfolgreich gespeichert."
@ -1486,12 +1519,13 @@ msgstr "Wählen Sie eine CSV-Datei zum Importieren von Anträgen aus!"
#: motion/templates/motion/import.html:11
msgid ""
"Required comma separated values: <code>{number, title, text, reason, "
"first_name, last_name}</code> (<code>number</code> and <code>reason</code> "
"are optional and may be empty)"
"first_name, last_name, is_group}</code> (<code>number</code>, <code>reason</"
"code> and <code>is_group</code> are optional and may be empty)"
msgstr ""
"Erforderliche kommaseparierte Werte: <code>{Nummer, Titel, Text, Begründung, "
"Vorname, Nachname}</code> (<code>Nummer</code> und <code>Begründung</code> "
"sind optional und können auch leer sein)"
"Vorname, Nachname, Gruppenantrag}</code> (<code>Nummer</code>, "
"<code>Begründung</code> und <code>Gruppenantrag</code> sind optional und "
"können auch leer sein)"
#: motion/templates/motion/import.html:13
#: participant/templates/participant/import.html:13
@ -2021,10 +2055,12 @@ msgid "Reset to First Password"
msgstr "Auf Erst-Passwort zurücksetzen"
#: participant/templates/participant/group_detail.html:14
#: participant/templates/projector/GroupSlide.html:13
msgid "Members"
msgstr "Mitglieder"
#: participant/templates/participant/group_detail.html:19
#: participant/templates/projector/GroupSlide.html:22
msgid "No members available."
msgstr "Keine Mitglieder vorhanden."
@ -2354,6 +2390,11 @@ msgstr "undefinierter-dateiname"
msgid "Enter valid JSON"
msgstr "Gebe valides JSON ein"
#~ msgid "Ignoring line %d because the assigned group does not exist."
#~ msgstr ""
#~ "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete "
#~ "Gruppe nicht existiert."
#~ msgid "posts"
#~ msgstr "Posten"

View File

@ -28,6 +28,8 @@ from openslides.config.signals import default_config_value
from openslides.poll.models import (BaseOption, BasePoll, CountVotesCast,
CountInvalid, BaseVote)
from openslides.participant.models import User, Group
from openslides.projector.api import register_slidemodel
from openslides.projector.models import SlideMixin
@ -443,7 +445,10 @@ class Motion(models.Model, SlideMixin):
self.log = ""
self.log += u"%s | %s" % (datetime.now().strftime("%d.%m.%Y %H:%M:%S"), _propper_unicode(text))
if user is not None:
if isinstance(user, User):
self.log += u" (%s %s)" % (_("by"), _propper_unicode(user.username))
else:
self.log += u" (%s %s)" % (_("by"), _propper_unicode(str(user)))
self.log += "\n"
self.save()

View File

@ -8,7 +8,7 @@
<h1>{% trans "Import motions" %}</h1>
<p>{% trans 'Select a CSV file to import motions!' %}</p>
<p>{% trans 'Required comma separated values: <code>{number, title, text, reason, first_name, last_name}</code> (<code>number</code> and <code>reason</code> are optional and may be empty)' %}
<p>{% trans 'Required comma separated values: <code>{number, title, text, reason, first_name, last_name, is_group}</code> (<code>number</code>, <code>reason</code> and <code>is_group</code> are optional and may be empty)' %}
<br>
{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}
</p>

View File

@ -52,7 +52,7 @@ from openslides.projector.projector import Widget
from openslides.poll.views import PollFormView
from openslides.participant.api import gen_username, gen_password
from openslides.participant.models import User
from openslides.participant.models import User, Group
from openslides.agenda.models import Item
@ -579,6 +579,8 @@ def motion_import(request):
users_generated = 0
motions_generated = 0
motions_modified = 0
groups_assigned = 0
groups_generated = 0
with transaction.commit_on_success():
dialect = csv.Sniffer().sniff(request.FILES['csvfile'].readline())
dialect = csv_ext.patchup(dialect)
@ -588,7 +590,11 @@ def motion_import(request):
if lno < 1:
continue
try:
(number, title, text, reason, first_name, last_name) = line[:6]
(number, title, text, reason, first_name, last_name, is_group) = line[:7]
if is_group.strip().lower() in ['y', 'j', 't', 'yes', 'ja', 'true', '1', 1]:
is_group = True
else:
is_group = False
except ValueError:
messages.error(request, _('Ignoring malformed line %d in import file.') % (lno + 1))
continue
@ -605,12 +611,38 @@ def motion_import(request):
except ValueError:
messages.error(request, _('Ignoring malformed line %d in import file.') % (lno + 1))
continue
if is_group:
# fetch existing groups or issue an error message
try:
user = Group.objects.get(name=last_name)
if user.group_as_person == False:
messages.error(request, _('Ignoring line %d because the assigned group may not act as a person.') % (lno + 1))
continue
else:
user = get_person(user.person_id)
groups_assigned += 1
except Group.DoesNotExist:
group = Group()
group.group_as_person = True
group.description = _('Created by motion import.')
group.name = last_name
group.save()
groups_generated += 1
user = get_person(group.person_id)
else:
# fetch existing users or create new users as needed
try:
user = User.objects.get(first_name=first_name, last_name=last_name)
except User.DoesNotExist:
user = None
if user is None:
if not first_name or not last_name:
messages.error(request, _('Ignoring line %d because it contains an incomplete first / last name pair.') % (lno + 1))
continue
user = User()
user.last_name = last_name
user.first_name = first_name
@ -653,6 +685,12 @@ def motion_import(request):
'%d motions were successfully modified.', motions_modified) % motions_modified)
if users_generated:
messages.success(request, ungettext('%d new user was added.', '%d new users were added.', users_generated) % users_generated)
if groups_generated:
messages.success(request, ungettext('%d new group was added.', '%d new groups were added.', groups_generated) % groups_generated)
if groups_assigned:
messages.success(request, ungettext('%d group assigned to motions.', '%d groups assigned to motions.', groups_assigned) % groups_assigned)
return redirect(reverse('motion_overview'))
except csv.Error: