Ejemplo n.º 1
0
def load_authors():
    if request.method == 'POST':
        data = request.form['data']
        cnt = models.load_author_data(data)
    data = {}
    data['message'] = '%i Authors loaded.' % (cnt,)
    data['return_url'] = url_for('data_index')
    data['return_url_text'] = 'Back to Data page.'
    return render_template('message.html',**data)
Ejemplo n.º 2
0
def sample_data():
    models.clear_db()
    with open('data/authors.txt','r') as f:
        author_data = f.read()
        cnt = models.load_author_data(author_data)

    with open('data/students.txt','r') as f:
        student_data = f.read()
        cnt = models.load_student_data(student_data)
    data = {}
    data['message'] = 'Sample data loaded.'
    data['return_url'] = url_for('index')
    data['return_url_text'] = 'Return to Home.'
    return render_template('message.html',**data)