Wrote log messages for motion changes
This commit is contained in:
parent
65a18953bd
commit
f4ea611fb8
@ -251,7 +251,6 @@ class Motion(SlideMixin, models.Model):
|
||||
if self.state.support:
|
||||
if not self.is_supporter(person):
|
||||
MotionSupporter(motion=self, person=person).save()
|
||||
self.write_log(ugettext_noop("Supporter: +%s") % person)
|
||||
else:
|
||||
raise WorkflowError("You can not support a motion in state %s" % self.state.name)
|
||||
|
||||
@ -261,7 +260,6 @@ class Motion(SlideMixin, models.Model):
|
||||
"""
|
||||
if self.state.support:
|
||||
self.supporter.filter(person=person).delete()
|
||||
self.write_log(ugettext_noop("Supporter: -%s") % person)
|
||||
else:
|
||||
raise WorkflowError("You can not unsupport a motion in state %s" % self.state.name)
|
||||
|
||||
|
@ -197,10 +197,13 @@ class SupportView(SingleObjectMixin, QuestionMixin, RedirectView):
|
||||
|
||||
def case_yes(self):
|
||||
if self.check_permission(self.request):
|
||||
user = self.request.user
|
||||
if self.support:
|
||||
self.object.support(person=self.request.user)
|
||||
self.object.support(person=user)
|
||||
self.object.write_log(ugettext_noop("Supporter: +%s") % user, user)
|
||||
else:
|
||||
self.object.unsupport(person=self.request.user)
|
||||
self.object.unsupport(person=user)
|
||||
self.object.write_log(ugettext_noop("Supporter: -%s") % user, user)
|
||||
|
||||
def get_success_message(self):
|
||||
if self.support:
|
||||
@ -225,6 +228,7 @@ class PollCreateView(SingleObjectMixin, RedirectView):
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
self.poll = self.object.create_poll()
|
||||
self.object.write_log(ugettext_noop("Poll created"), user)
|
||||
messages.success(request, _("New vote was successfully created."))
|
||||
|
||||
def get_redirect_url(self, **kwargs):
|
||||
@ -256,12 +260,21 @@ class PollUpdateView(PollMixin, PollFormView):
|
||||
'motion': self.poll.motion})
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
value = super(PollUpdateView, self).form_valid(form)
|
||||
self.object.write_log(ugettext_noop('Poll updated'), self.request.user)
|
||||
return value
|
||||
|
||||
poll_edit = PollUpdateView.as_view()
|
||||
|
||||
|
||||
class PollDeleteView(PollMixin, DeleteView):
|
||||
model = MotionPoll
|
||||
|
||||
def case_yes(self):
|
||||
super(PollDeleteView, self).case_yes()
|
||||
self.object.write_log(ugettext_noop('Poll deleted'), self.request.user)
|
||||
|
||||
poll_delete = PollDeleteView.as_view()
|
||||
|
||||
|
||||
@ -282,6 +295,9 @@ class MotionSetStateView(SingleObjectMixin, RedirectView):
|
||||
messages.error(request, e)
|
||||
else:
|
||||
self.object.save()
|
||||
# TODO: the state is not translated
|
||||
self.object.write_log(ugettext_noop('Changed state to %s') %
|
||||
self.object.state.name, self.request.user)
|
||||
messages.success(request, _('Motion status was set to: %s.'
|
||||
% html_strong(self.object.state)))
|
||||
|
||||
@ -303,6 +319,7 @@ class CreateAgendaItemView(SingleObjectMixin, RedirectView):
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
self.item = Item.objects.create(related_sid=self.object.sid)
|
||||
self.object.write_log(ugettext_noop('Created Agenda Item'), self.request.user)
|
||||
|
||||
create_agenda_item = CreateAgendaItemView.as_view()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user