Fixed #655 Log Entry for imported motions

This commit is contained in:
Norman Jäckel 2013-05-16 00:58:37 +02:00
parent a5a9848040
commit 27da18f489
3 changed files with 11 additions and 8 deletions

View File

@ -17,14 +17,14 @@
import csv import csv
from django.db import transaction 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 openslides.utils.person.api import Persons
from .models import Motion, Category 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. Imports motions from a csv file.
@ -102,6 +102,8 @@ def import_motions(csv_file, default_submitter, override=False):
motion.clear_submitters() motion.clear_submitters()
motion.add_submitter(new_submitter) motion.add_submitter(new_submitter)
motion.write_log(message=ugettext_noop('Motion imported'),
person=importing_person)
count_success += 1 count_success += 1
return (count_success, error_messages, warning_messages) return (count_success, error_messages, warning_messages)

View File

@ -493,11 +493,11 @@ class Motion(SlideMixin, models.Model):
return actions return actions
def write_log(self, message, person=None): def write_log(self, message, person=None):
"""Write a log message. """
Write a log message.
Message should be in english and translatable. The message should be in English and translatable,
e. g. motion.write_log(message=ugettext_noop('Message Text'))
e.g.: motion.write_log(ugettext_noob('Message Text'))
""" """
MotionLog.objects.create(motion=self, message=message, person=person) MotionLog.objects.create(motion=self, message=message, person=person)

View File

@ -685,8 +685,9 @@ class MotionCSVImportView(FormView):
""" """
count_success, error_messages, warning_messages = import_motions( count_success, error_messages, warning_messages = import_motions(
self.request.FILES['csvfile'], self.request.FILES['csvfile'],
default_submitter=self.request.user, default_submitter=form.cleaned_data['default_submitter'],
override=form.cleaned_data['override']) override=form.cleaned_data['override'],
importing_person=self.request.user)
for message in error_messages: for message in error_messages:
messages.error(self.request, message) messages.error(self.request, message)
for message in warning_messages: for message in warning_messages: