]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blobdiff - wradmin/controllers/rodelbahn.py
Allow to JSON-edit a sledrun.
[philipp/winterrodeln/wradmin.git] / wradmin / controllers / rodelbahn.py
index 2089cdd2f925635402f42bc7cfebbba4bc8a1c99..345cbc113e27d9ec679d8c4a47b556dcae57a6fd 100644 (file)
@@ -8,6 +8,7 @@ import wrpylib.mwmarkup
 
 from wradmin.app import db
 from wradmin.model import WrSledrunCache, WrReport
+from wradmin.template_helper import PylonsHelper
 
 
 class RodelbahnController:
@@ -34,6 +35,18 @@ class RodelbahnController:
                                   items_per_page=25)
         return render_template('rodelbahn_view.html', sledding=sledrun, paginator=paginator)
 
+    def json_edit(self, sledrun_id):
+        q = db.session.query(WrSledrunCache)
+        sledrun = q.get(sledrun_id)
+        if sledrun is None:
+            abort(404)
+        h = PylonsHelper()
+        return render_template('json_editor.html',
+                               schema_url=url_for('static', filename='schema_v1.json'),
+                               #json_url=url_for('static', filename='latschenhuette.json')
+                               json_url=h.wiki(sledrun.page_title)
+                               )
+
     def update(self):
         """Updates the wrsledruncache table from the wiki"""
         c = db.session.connection()