Skip to content
Snippets Groups Projects
Commit fe18d043 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

implement full export

parent a9754f46
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from .resources.submissions import Submissions
from .resources import signature
from .resources import images
from .resources import summary_plot
from .resources import export
from .resources.problems import Problems
from .resources.feedback import Feedback
......@@ -53,3 +54,9 @@ api_bp.add_url_rule(
'exam_summary',
summary_plot.get,
)
api_bp.add_url_rule(
'/export/full',
'full_export',
export.full,
)
import os
from io import BytesIO
from flask import abort, Response, current_app as app
from pony import orm
from ..helpers import db_helper
def full():
"""Export the complete database
Returns
-------
course.sqlite
"""
data_dir = app.config['DATA_DIRECTORY']
with open(os.path.join(data_dir, 'course.sqlite'), 'rb') as f:
data = f.read()
resp = Response(data, 200)
resp.headers.set('Content-Disposition', 'attachment',
filename='course.sqlite')
return resp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment