Esempio n. 1
0
def find_files():
    if request.method == 'POST':
        surname = surnames["Surname"]
        patients, items = Database.search(surname)
        file = FilesFinder(surname)
        file.make_dir()
        try:
            file.search_files()
        except FileNotFoundError:
            return render_template('items.html', data=patients, items=items,message="files not found")
        else:
            return render_template('items.html', data=patients, items=items,message="files downloaded successfully")
    return redirect(url_for('home'))



@app.route('/delete', methods=["GET","POST"])
def delete_patient():
    if request.method == 'POST' and request.form['action'] == 'delete patient':
        surname = request.form.get('Surname')
        Database.delete(surname)
        return redirect(url_for('show_patients'))
    return redirect(url_for('home'))


if __name__=='__main__':
    Database.database_exists()
    app.run(debug=True)