Esempio n. 1
0
    def _process(self):
        cfp = self.event.cfp
        form_data = {
            'managers': cfp.managers,
            'judges': cfp.judges,
            'content_reviewers': cfp.content_reviewers,
            'layout_reviewers': cfp.layout_reviewers
        }

        form = PaperTeamsForm(event=self.event, **form_data)
        if form.validate_on_submit():
            teams = {
                'managers': form.managers.data,
                'judges': form.judges.data
            }
            if cfp.content_reviewing_enabled:
                teams['content_reviewers'] = form.content_reviewers.data
            if cfp.layout_reviewing_enabled:
                teams['layout_reviewers'] = form.layout_reviewers.data
            unassigned_contribs = update_team_members(self.event, **teams)
            flash(_("The members of the teams were updated successfully"), 'success')
            if unassigned_contribs:
                flash(ngettext("Users have been removed from 1 contribution",
                               "Users have been removed from {} contributions",
                               len(unassigned_contribs)).format(len(unassigned_contribs)),
                      'warning')
            return jsonify_data()
        return jsonify_template('events/papers/management/teams.html', form=form)
Esempio n. 2
0
    def _process(self):
        cfp = self.event.cfp
        form_data = {
            'managers': cfp.managers,
            'judges': cfp.judges,
            'content_reviewers': cfp.content_reviewers,
            'layout_reviewers': cfp.layout_reviewers
        }

        form = PaperTeamsForm(event=self.event, **form_data)
        if form.validate_on_submit():
            teams = {
                'managers': form.managers.data,
                'judges': form.judges.data
            }
            if cfp.content_reviewing_enabled:
                teams['content_reviewers'] = form.content_reviewers.data
            if cfp.layout_reviewing_enabled:
                teams['layout_reviewers'] = form.layout_reviewers.data
            unassigned_contribs = update_team_members(self.event, **teams)
            flash(_("The members of the teams were updated successfully"), 'success')
            if unassigned_contribs:
                flash(ngettext("Users have been removed from 1 contribution",
                               "Users have been removed from {} contributions",
                               len(unassigned_contribs)).format(len(unassigned_contribs)),
                      'warning')
            return jsonify_data()
        return jsonify_template('events/papers/management/teams.html', form=form)