Example #1
0
    def get(self):
        flag = request.args.get('flag')
        category_tags = request.args.getlist('category_tags')
        category_tags = (CategoryTag.query.filter(
            CategoryTag.id.in_(category_tags)).all())
        page = request.args.get('page', 1, type=int)
        query = self._get_query(flag, category_tags)
        count = query.count()
        pagination = query.paginate(page, per_page=1000)
        participants = pagination.items
        flag_form = FlagForm(request.args)
        category_tags_form = CategoryTagForm(request.args)
        if not category_tags:
            title = 'General admission'
        else:
            title = (', '.join([tag.label
                                for tag in category_tags]) + ' admission')
        flag = g.meeting.custom_fields.filter_by(slug=flag).first()

        return render_template('meetings/printouts/admission.html',
                               participants=participants,
                               pagination=pagination,
                               count=count,
                               title=title,
                               flag=flag,
                               category_tags=category_tags,
                               flag_form=flag_form,
                               category_tags_form=category_tags_form)
    def get(self):
        flag = request.args.get('flag')
        category_tags = request.args.getlist('category_tags')
        categories = request.args.getlist('categories')
        page = request.args.get('page', 1, type=int)

        events = g.meeting.custom_fields.filter_by(
            field_type=CustomField.EVENT)

        query = self._get_query(flag, category_tags, categories)
        count = query.count()
        pagination = query.paginate(page, per_page=50)
        participants = pagination.items

        flag_form = FlagForm(request.args)
        category_tags_form = CategoryTagForm(request.args)
        categories_form = ParticipantCategoriesForm(request.args)

        return render_template(
            'printouts/observers.html',
            participants=participants,
            events=events,
            pagination=pagination,
            count=count,
            title=self.DOC_TITLE,
            flag=flag,
            flag_form=flag_form,
            category_tags=category_tags,
            category_tags_form=category_tags_form,
            categories=categories,
            categories_form=categories_form,
        )
    def get(self):
        flag_slug = request.args.get('flag')
        category_tag_ids = request.args.getlist('category_tags')
        category_tags = (CategoryTag.query.filter(
            CategoryTag.id.in_(category_tag_ids)).all())
        page = request.args.get('page', 1, type=int)
        query = self._get_query(flag_slug, category_tags)
        pagination = query.paginate(page, per_page=50)
        participants = pagination.items
        flag_form = FlagForm(request.args)
        flag_form.flag.choices = [
            choice for choice in flag_form.flag.choices
            if choice[0] != 'credentials'
        ]
        category_tags_form = CategoryTagForm(request.args)
        flag = g.meeting.custom_fields.filter_by(slug=flag_slug).first()

        return render_template('printouts/credentials.html',
                               participants=participants,
                               pagination=pagination,
                               title=self.DOC_TITLE,
                               flag=flag,
                               flag_slug=flag_slug,
                               flag_form=flag_form,
                               category_tag_ids=category_tag_ids,
                               category_tags_form=category_tags_form)
Example #4
0
 def get(self):
     flag = request.args.get('flag')
     query = self._get_query(flag)
     participants = groupby(query, key=attrgetter('category'))
     flag_form = FlagForm(request.args)
     flag = g.meeting.custom_fields.filter_by(slug=flag).first()
     return render_template('meetings/printouts/delegation_list.html',
                            participants=participants,
                            title=self.DOC_TITLE,
                            flag=flag,
                            flag_form=flag_form)
Example #5
0
    def get(self):
        flag = request.args.get('flag')
        query = self._get_query(flag)
        count = query.count()
        participants = groupby(query, key=attrgetter('language'))
        flag_form = FlagForm(request.args)
        flag = g.meeting.custom_fields.filter_by(slug=flag).first()

        return render_template('meetings/printouts/distribution.html',
                               printout_type=self.printout_type,
                               participants=participants,
                               count=count,
                               title=self.DOC_TITLE,
                               table_class=self.table_class,
                               flag=flag,
                               flag_form=flag_form)
Example #6
0
 def get(self):
     flag = request.args.get('flag')
     page = request.args.get('page', 1, type=int)
     query = self._get_query(flag)
     count = query.count()
     pagination = query.paginate(page, per_page=50)
     participants = groupby(pagination.items, key=attrgetter('category'))
     flag_form = FlagForm(request.args)
     flag = g.meeting.custom_fields.filter_by(slug=flag).first()
     return render_template('meetings/printouts/short_list.html',
                            participants=participants,
                            pagination=pagination,
                            count=count,
                            title=self.DOC_TITLE,
                            flag=flag,
                            flag_form=flag_form)
Example #7
0
 def get(self):
     flag = request.args.get('flag')
     title = self.TITLE_MAP.get(flag, self.DOC_TITLE)
     page = request.args.get('page', 1, type=int)
     query = self._get_query(flag)
     count = query.count()
     pagination = query.paginate(page, per_page=50)
     participants = pagination.items
     flag_form = FlagForm(request.args)
     flag = g.meeting.custom_fields.filter_by(slug=flag).first()
     return render_template('meetings/printouts/provisional_list.html',
                            participants=participants,
                            pagination=pagination,
                            count=count,
                            title=title,
                            flag_form=flag_form,
                            flag=flag)
    def get(self):
        flag = request.args.get('flag')
        title = self.TITLE_MAP.get(flag, self.DOC_TITLE)
        try:
            categories_ids = map(int, request.args.getlist("category_filter"))
        except (KeyError, ValueError, TypeError):
            categories_ids = []
        page = int(request.args.get("page", 1))
        page_size = int(request.args.get("page_size", self.PAGE_SIZE))

        flag_form = FlagForm(request.args)

        participant_form = custom_form_factory(ParticipantEditForm)
        all_fields = self._get_all_fields()
        selected_field_ids = self._get_selected_field_ids()
        selected_fields = list(
            participant_form().get_fields(field_ids=selected_field_ids))

        with db.session.no_autoflush:
            grouped_participants, count = self.get_participants(
                flag=flag,
                categories_ids=categories_ids,
                selected_field_ids=selected_field_ids,
                page=page,
                page_size=page_size,
            )
            total_pages = int(math.ceil(count / page_size))

            return render_template(
                'meetings/printouts/provisional_list.html',
                all_fields=all_fields,
                selected_field_ids=selected_field_ids,
                selected_fields=selected_fields,
                grouped_participants=grouped_participants,
                count=count,
                title=title,
                flag_form=flag_form,
                flag=flag,
                page=page,
                total_pages=total_pages,
            )