Example #1
0
    def form_valid(self, form):
        resp = super(PublishUpcomingView, self).form_valid(form)

        c = self.object

        # increment agenda if publishing agenda.
        if not c.upcoming_meeting_started and form.cleaned_data['send_to'] != []:
            c.upcoming_meeting_is_published = True
            c.upcoming_meeting_published_at = datetime.datetime.now()
            c.upcoming_meeting_version += 1

            c.save()

        template = 'protocol_draft' if c.upcoming_meeting_started else 'agenda'
        tpl_data = {
            'meeting_time': datetime.datetime.now().replace(second=0),
            'can_straw_vote': c.upcoming_proposals_any(
                {'is_open': True}, user=self.request.user, committee=self.object
            ) and c.upcoming_meeting_is_published
        }
        total = send_mail(c, template, self.request.user, form.cleaned_data['send_to'], tpl_data,
                          send_to_me=form.cleaned_data['me'])
        messages.info(self.request, _("Sending to %d users") % total)

        return resp
Example #2
0
    def form_valid(self, form):
        resp = super().form_valid(form)

        c = self.object

        # increment agenda if publishing agenda.
        if not c.upcoming_meeting_started and form.cleaned_data[
                'send_to'] != SendToOption.ONLY_ME:
            if form.cleaned_data['send_to'] == SendToOption.ALL_MEMBERS:
                c.upcoming_meeting_is_published = True
            c.upcoming_meeting_published_at = datetime.datetime.now()
            c.upcoming_meeting_version += 1

            c.save()

        template = 'protocol_draft' if c.upcoming_meeting_started else 'agenda'
        tpl_data = {
            'meeting_time': datetime.datetime.now().replace(second=0),
            'can_straw_vote': c.upcoming_proposals_any({'is_open': True},
                                                       user=self.request.user,
                                                       community=self.object) \
                              and c.upcoming_meeting_is_published,
        }
        total = send_mail(c, template, self.request.user,
                          form.cleaned_data['send_to'], tpl_data)
        messages.info(self.request, _("Sending to %d users") % total)

        return resp
Example #3
0
 def form_valid(self, form):
     # archive selected issues
     m = self.committee.close_meeting(form.instance, self.request.user, self.committee)
     Issue.objects.filter(id__in=form.cleaned_data['issues']).update(
         completed=True, status=IssueStatus.ARCHIVED)
     total = send_mail(self.committee, 'protocol', self.request.user, form.cleaned_data['send_to'], {'meeting': m})
     messages.info(self.request, _("Sending to %d users") % total)
     return HttpResponse(m.get_absolute_url())
Example #4
0
 def form_valid(self, form):
     # archive selected issues
     m = self.community.close_meeting(form.instance, self.request.user,
                                      self.community)
     Issue.objects.filter(id__in=form.cleaned_data['issues']).update(
         completed=True, status=IssueStatus.ARCHIVED)
     total = send_mail(self.community, 'protocol', self.request.user,
                       form.cleaned_data['send_to'], {'meeting': m})
     messages.info(self.request, _("Sending to %d users") % total)
     return HttpResponse(m.get_absolute_url())
Example #5
0
 def form_valid(self, form):
     # archive selected issues
     m = self.community.close_meeting(form.instance, self.request.user, self.community)
     # Update email pixels with meeting obj
     EmailPixelUser.objects.filter(m_id=m.id, subject='agenda', meeting__isnull=True).update(meeting=m)
     # Assign meeting to attachments
     attachments = MeetingAttachment.objects.filter(meeting__isnull=True)
     if attachments:
         attachments.update(meeting=m)
     Issue.objects.filter(id__in=form.cleaned_data['issues']).update(
         completed=True, status=IssueStatus.ARCHIVED)
     total = send_mail(self.community, 'protocol', self.request.user,
                       form.cleaned_data['send_to'], {'meeting': m})
     messages.info(self.request, _("Sending to %d users") % total)
     return HttpResponse(m.get_absolute_url())
Example #6
0
    def form_valid(self, form):
        resp = super(PublishUpcomingView, self).form_valid(form)

        c = self.object

        # increment agenda if publishing agenda.
        if not c.upcoming_meeting_started and form.cleaned_data["send_to"] != SendToOption.ONLY_ME:
            if form.cleaned_data["send_to"] == SendToOption.ALL_MEMBERS:
                c.upcoming_meeting_is_published = True
            c.upcoming_meeting_published_at = datetime.datetime.now()
            c.upcoming_meeting_version += 1

            c.save()

        template = "protocol_draft" if c.upcoming_meeting_started else "agenda"
        tpl_data = {
            "meeting_time": datetime.datetime.now().replace(second=0),
            "can_straw_vote": c.upcoming_proposals_any({"is_open": True}, user=self.request.user, community=self.object)
            and c.upcoming_meeting_is_published,
        }
        total = send_mail(c, template, self.request.user, form.cleaned_data["send_to"], tpl_data)
        messages.info(self.request, _("Sending to %d users") % total)

        return resp