Skip to content

Instantly share code, notes, and snippets.

@gsathya
Created March 24, 2012 05:51
Show Gist options
  • Save gsathya/2178790 to your computer and use it in GitHub Desktop.
Save gsathya/2178790 to your computer and use it in GitHub Desktop.
From e0a670f99818ceda88c29a35aa9aee361b3dc8a0 Mon Sep 17 00:00:00 2001
From: Sathyanarayanan Gunasekaran <[email protected]>
Date: Sat, 24 Mar 2012 11:20:04 +0530
Subject: [PATCH] Add keywords to tasks
Support associating keywords (text strings) with tasks
---
modules/eden/cms.py | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/modules/eden/cms.py b/modules/eden/cms.py
index 2ff64b2..ab55620 100644
--- a/modules/eden/cms.py
+++ b/modules/eden/cms.py
@@ -45,6 +45,8 @@ class S3ContentModel(S3Model):
names = ["cms_series",
"cms_post",
"cms_comment",
+ "cms_keywords",
+ "cms_resource_keywords"
]
def model(self):
@@ -238,6 +240,45 @@ class S3ContentModel(S3Model):
# ---------------------------------------------------------------------
# Pass variables back to global scope (response.s3.*)
#
+
+
+ # ---------------------------------------------------------------------
+ # Keywords
+
+ tablename = "cms_keywords"
+ table = define_table(tablename,
+ Field("keyword", "text",
+ notnull=True,)
+ *meta_fields())
+
+ # Resource Configuration
+ configure(tablename,
+ list_fields=["id",
+ "keyword_id",
+ "keyword",
+ "created_by",
+ "modified_on"
+ ])
+
+ # ---------------------------------------------------------------------
+ # Keyword Tag - Used to tag a keyword to a resource
+
+ tablename = "cms_resource_keyword"
+ table = self.define_table(tablename,
+ message_id(),
+ Field("resource"),
+ Field("record_uuid",
+ type=s3uuid,
+ length=128),
+ *s3.meta_fields())
+
+ self.configure(tablename,
+ list_fields=[ "id",
+ "keyword_id",
+ "record_uuid",
+ "resource",
+ ])
+
return Storage()
# -------------------------------------------------------------------------
--
1.7.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment