diff --git a/openslides/motion/csv_import.py b/openslides/motion/csv_import.py index a710977b8..6973fb566 100644 --- a/openslides/motion/csv_import.py +++ b/openslides/motion/csv_import.py @@ -17,14 +17,14 @@ import csv from django.db import transaction -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext as _, ugettext_noop from openslides.utils.person.api import Persons from .models import Motion, Category -def import_motions(csv_file, default_submitter, override=False): +def import_motions(csv_file, default_submitter, override=False, importing_person=None): """ Imports motions from a csv file. @@ -102,6 +102,8 @@ def import_motions(csv_file, default_submitter, override=False): motion.clear_submitters() motion.add_submitter(new_submitter) + motion.write_log(message=ugettext_noop('Motion imported'), + person=importing_person) count_success += 1 return (count_success, error_messages, warning_messages) diff --git a/openslides/motion/models.py b/openslides/motion/models.py index 6074c513a..707a91e5a 100644 --- a/openslides/motion/models.py +++ b/openslides/motion/models.py @@ -493,11 +493,11 @@ class Motion(SlideMixin, models.Model): return actions def write_log(self, message, person=None): - """Write a log message. + """ + Write a log message. - Message should be in english and translatable. - - e.g.: motion.write_log(ugettext_noob('Message Text')) + The message should be in English and translatable, + e. g. motion.write_log(message=ugettext_noop('Message Text')) """ MotionLog.objects.create(motion=self, message=message, person=person) diff --git a/openslides/motion/views.py b/openslides/motion/views.py index a79f4cb40..48b54807e 100644 --- a/openslides/motion/views.py +++ b/openslides/motion/views.py @@ -685,8 +685,9 @@ class MotionCSVImportView(FormView): """ count_success, error_messages, warning_messages = import_motions( self.request.FILES['csvfile'], - default_submitter=self.request.user, - override=form.cleaned_data['override']) + default_submitter=form.cleaned_data['default_submitter'], + override=form.cleaned_data['override'], + importing_person=self.request.user) for message in error_messages: messages.error(self.request, message) for message in warning_messages: