本文整理汇总了Python中models.Location.gql方法的典型用法代码示例。如果您正苦于以下问题:Python Location.gql方法的具体用法?Python Location.gql怎么用?Python Location.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Location
的用法示例。
在下文中一共展示了Location.gql方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import gql [as 别名]
def get(self):
puzzles = Puzzle.gql("ORDER BY name ASC")
pieces = self.get_pieces()
locations = Location.gql("ORDER BY x ASC")
svg_path = os.path.join(os.path.dirname(__file__), 'templates/puzzle.svg')
svg_values = {
"pieces": pieces,
"locations": locations,
"width": 641,
"height": 481
}
svg_text = template.render(svg_path, svg_values)
try:
first_puzzle = puzzles[0]
except IndexError:
first_puzzle = "None"
template_values = {
"title": "HTML5 Hacks: SVG",
"puzzles": puzzles,
"first_puzzle": first_puzzle,
"host": os.environ["HTTP_HOST"],
"config": config,
"svg_text": svg_text,
"is_dev": IS_DEV,
"rows": ["A", "B", "C", "D", "E", "F", "G", "H"],
"cols": ["1", "2", "3", "4", "5", "6", "7", "8"],
}
path = os.path.join(os.path.dirname(__file__), 'templates/svg.html')
self.response.out.write(template.render(path, template_values))