aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2018-04-15 18:47:58 +0200
committerGravatar Gareth Coles <[email protected]>2018-04-15 17:47:58 +0100
commitf5e7c358761ee49da45933e73b943fb1eb66c030 (patch)
treecde9eed9f010caba22842d39af33385aae411a45 /pysite/views
parentAdded an About category with Partners view (#1pv7h) (#50) (diff)
Initial data for tables and refactoring the dev-mode database handling to be similar to prod-mode. (#53)
* Changed the dev-mode logic to be the same as prod for creating new tables if they don't exist. Also added a new feature where a table can be initialized with data if you create a JSON file in the pysite/database/table_init/ folder and fill it with a list of dicts where each dict represents a row in your table. Included a hiphoppers json so that I can actually test if it works in production. It will only init the table if the table is empty. * Not sure if this will solve it, but I think so. * Renamed the tables and primary keys, and alphabetized the dict. Now complies with the gdudes holy wishes.
Diffstat (limited to 'pysite/views')
-rw-r--r--pysite/views/api/bot/tags.py1
-rw-r--r--pysite/views/api/bot/user.py1
-rw-r--r--pysite/views/wiki/edit.py2
-rw-r--r--pysite/views/wiki/page.py2
-rw-r--r--pysite/views/wiki/source.py2
5 files changed, 0 insertions, 8 deletions
diff --git a/pysite/views/api/bot/tags.py b/pysite/views/api/bot/tags.py
index 21b64c2c..ee1a1bee 100644
--- a/pysite/views/api/bot/tags.py
+++ b/pysite/views/api/bot/tags.py
@@ -32,7 +32,6 @@ class TagsView(APIView, DBMixin):
path = "/tags"
name = "api.bot.tags"
table_name = "tags"
- table_primary_key = "tag_name"
@api_key
@api_params(schema=GET_SCHEMA, validation_type=ValidationTypes.params)
diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py
index da5fe0aa..3d8d7271 100644
--- a/pysite/views/api/bot/user.py
+++ b/pysite/views/api/bot/user.py
@@ -23,7 +23,6 @@ class UserView(APIView, DBMixin):
path = "/user"
name = "api.bot.user"
table_name = "users"
- table_primary_key = "user_id"
@api_key
@api_params(schema=SCHEMA, validation_type=ValidationTypes.json)
diff --git a/pysite/views/wiki/edit.py b/pysite/views/wiki/edit.py
index 0d70fed5..9eb50c9e 100644
--- a/pysite/views/wiki/edit.py
+++ b/pysite/views/wiki/edit.py
@@ -13,9 +13,7 @@ from pysite.rst import render
class EditView(RouteView, DBMixin):
path = "/edit/<path:page>" # "path" means that it accepts slashes
name = "edit"
-
table_name = "wiki"
- table_primary_key = "slug"
@require_roles(*EDITOR_ROLES)
def get(self, page):
diff --git a/pysite/views/wiki/page.py b/pysite/views/wiki/page.py
index 36fdcd39..500d5c04 100644
--- a/pysite/views/wiki/page.py
+++ b/pysite/views/wiki/page.py
@@ -10,9 +10,7 @@ from pysite.mixins import DBMixin
class PageView(RouteView, DBMixin):
path = "/wiki/<path:page>" # "path" means that it accepts slashes
name = "page"
-
table_name = "wiki"
- table_primary_key = "slug"
def get(self, page):
obj = self.db.get(self.table_name, page)
diff --git a/pysite/views/wiki/source.py b/pysite/views/wiki/source.py
index 7038dad9..80f362df 100644
--- a/pysite/views/wiki/source.py
+++ b/pysite/views/wiki/source.py
@@ -13,9 +13,7 @@ from pysite.mixins import DBMixin
class PageView(RouteView, DBMixin):
path = "/source/<path:page>" # "path" means that it accepts slashes
name = "source"
-
table_name = "wiki"
- table_primary_key = "slug"
def get(self, page):
obj = self.db.get(self.table_name, page)