summaryrefslogtreecommitdiff
path: root/cli/app/controllers/tile_controller.py
blob: fc36943a3e1535c65ecbb8ef7e3b55b13cbcd827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from flask import request, jsonify, redirect
from flask_classful import route
from werkzeug.datastructures import MultiDict

from app.sql.common import db, Session
from app.sql.models.tile import Tile, TileForm
from app.controllers.crud_controller import CrudView

class TileView(CrudView):
  model = Tile
  form = TileForm

  def where(self, query, args):
    graph_id = args.get('graph_id', default=None)
    if graph_id is not None:
      query = query.where(Tile.graph_id == int(graph_id))
    page_id = args.get('page_id', default=None)
    if page_id is not None:
      query = query.where(Tile.page_id == int(page_id))
    return query