File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121import naucse_render
2222
23+ API_VERSION = 0 , 1
24+
2325# XXX: Different timezones?
2426_TIMEZONE = 'Europe/Prague'
2527
Original file line number Diff line number Diff line change @@ -399,12 +399,14 @@ def schema(model_slug, is_input):
399399 cls = models .models [model_slug ]
400400 except KeyError :
401401 abort (404 )
402- return jsonify (models .get_schema (cls , is_input = is_input ))
402+ return jsonify (models .get_schema (
403+ cls , is_input = is_input , version = models .API_VERSION ,
404+ ))
403405
404406
405407@app .route ('/v0/naucse.json' )
406408def api ():
407- return jsonify (models .dump (g .model ))
409+ return jsonify (models .dump (g .model , version = models . API_VERSION ))
408410
409411
410412@app .route ('/v0/years/<int:year>.json' )
@@ -413,7 +415,7 @@ def run_year_api(year):
413415 run_year = g .model .run_years [year ]
414416 except KeyError :
415417 abort (404 )
416- return jsonify (models .dump (run_year ))
418+ return jsonify (models .dump (run_year , version = models . API_VERSION ))
417419
418420
419421@app .route ('/v0/<course:course_slug>.json' )
@@ -422,4 +424,4 @@ def course_api(course_slug):
422424 course = g .model .courses [course_slug ]
423425 except KeyError :
424426 abort (404 )
425- return jsonify (models .dump (course ))
427+ return jsonify (models .dump (course , version = models . API_VERSION ))
You can’t perform that action at this time.
0 commit comments