From 4bba9d0cdf8361e5529281a98d14bc4bb0ceb669 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Sat, 19 May 2018 20:13:51 +0200 Subject: Snake cog (#71) * Tables that are initialized with JSON files in the table_init folder will now sync properly if the JSON file is changed after initialization. Any lines that are either added or removed will be updated whenever site is rebooted. * Initial API endpoint for snake_quiz * reverting database.py * I WILL KILL YOU * Added the snake_fact API endpoint * Moving snake tables to the new migrations system * Set up initial data for all new tables, added table objects, wrote endpoints, and wrote tests for the new endpoints. * Removing the snake_movies endpoint. That idea didn't pan out. * Added an endpoint for getting special snake cases * broken json * Fixing the initial data slightly, better picture of bob. * Changing JSON indentation to be 4 spaces consistently in all initial_data, to address Aperture's review. Also changing all the endpoints to have correct namespacing, addressing gdude's review. * Fixing tests to point to new API endpoints --- pysite/tables.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'pysite/tables.py') diff --git a/pysite/tables.py b/pysite/tables.py index c180e161..c592333d 100644 --- a/pysite/tables.py +++ b/pysite/tables.py @@ -126,6 +126,52 @@ TABLES = { ]) ), + "snake_facts": Table( # Snake facts + primary_key="fact", + keys=sorted([ + "fact" + ]), + locked=False + ), + + "snake_idioms": Table( # Snake idioms + primary_key="idiom", + keys=sorted([ + "idiom" + ]), + locked=False + ), + + "snake_names": Table( # Snake names + primary_key="name", + keys=sorted([ + "name", + "scientific" + ]), + locked=False + ), + + "snake_quiz": Table( # Snake questions and answers + primary_key="id", + keys=sorted([ + "id", + "question", + "options", + "answerkey" + ]), + locked=False + ), + + "special_snakes": Table( # Special case snakes for the snake converter + primary_key="name", + keys=sorted([ + "name", + "info", + "image_list", + ]), + locked=False + ), + "tags": Table( # Tag names and values primary_key="tag_name", keys=sorted([ -- cgit v1.2.3