Ejemplo n.º 1
0
def download():
    query_sets = SampleNature.query.filter_by(id=1).all()
    column_names = ['name', 'siggle', 'desqcription']
    return excel.make_response_from_query_sets(query_sets,
                                               column_names,
                                               "xls",
                                               file_name="template")
Ejemplo n.º 2
0
def docustomexport():
    query_sets = Patient.query.all()
    for row in query_sets:
        print(row.__dict__)
    column_names = ['id', 'serial', '', '', '']
    return excel.make_response_from_query_sets(query_sets,
                                               column_names,
                                               "xls",
                                               file_name="export_data")
Ejemplo n.º 3
0
def get_tg_users_excel():
    try:
        query_sets = TelegramUser.query.all()
        column_names = ['id', 'first_name', 'last_name', 'username', 'language_code', 'phone_number', 'course']
        return excel.make_response_from_query_sets(
            query_sets, column_names, "xlsx", dest_sheet_name="webinar-participants"
        )
    except Exception as e:
        flash('0 пользователей в телеграм-боте')
        return redirect(url_for('index'))
Ejemplo n.º 4
0
def download():
    query_sets = Process.query.filter_by(id=1).all()
    column_names = [
        'category_id', 'display_as', 'firstname', 'lastname', 'adresse',
        'telephone', 'email'
    ]
    return excel.make_response_from_query_sets(query_sets,
                                               column_names,
                                               "xls",
                                               file_name="template")
Ejemplo n.º 5
0
def get_report_csv():
    from_date = request.args.get('from_date')
    to_date = request.args.get('to_date')

    reports = Report.query.filter(
        and_(Report.teaching_date >= from_date,
             Report.teaching_date <= to_date)).all()
    column_names = [
        'teaching_date', 'main_teacher', 'assistant_teacher',
        'teaching_content', 'student_attendance', 'submitted_by'
    ]
    file_name = f'{from_date} - {to_date}'
    return excel.make_response_from_query_sets(reports,
                                               column_names,
                                               file_type='csv',
                                               file_name=file_name)
    def index(self):
        form = GetReportsAdminForm()

        if form.validate_on_submit():
            from_date = form.from_date.data
            to_date = form.to_date.data

            reports = Report.query.filter(
                and_(Report.teaching_date >= from_date, Report.teaching_date <= to_date)).all()

            if len(reports) == 0:
                flash(message='No reports are found.')
                return redirect(self.url)

            column_names = ['teaching_date', 'main_teacher', 'assistant_teacher',
                            'teaching_content', 'student_attendance', 'submitted_by']
            file_name = f'{from_date} - {to_date}'
            return excel.make_response_from_query_sets(reports, column_names, file_type='csv', file_name=file_name)

        return self.render('admin/teacher_attendance.html', form=form)
Ejemplo n.º 7
0
def docustomexport():
    query_sets = Sample.query.all()
    column_names = ['id', 'serial', 'code', 'sample_nature_id', 'sample_type_id']
    for key in query_sets.columns:
        column_names.append(key)
    return excel.make_response_from_query_sets(query_sets, column_names, "xls", file_name="export_data")