Skip to content

Commit ee9b4bc

Browse files
committed
views: Use version 0.1 in the exported API
1 parent 0dd27e1 commit ee9b4bc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

naucse/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import naucse_render
2222

23+
API_VERSION = 0, 1
24+
2325
# XXX: Different timezones?
2426
_TIMEZONE = 'Europe/Prague'
2527

naucse/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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')
406408
def 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))

0 commit comments

Comments
 (0)