Created
March 24, 2012 06:42
-
-
Save gsathya/2179110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d31badd2632d8f96ba1a71ca208c1b4498f6d5da 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 | 44 ++++++++++++++++++++++++++++++++++++++++++++ | |
1 files changed, 44 insertions(+), 0 deletions(-) | |
diff --git a/modules/eden/cms.py b/modules/eden/cms.py | |
index 2ff64b2..fa801ff 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,48 @@ 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, | |
+ Field("keyword"), | |
+ Field("keyword_id", "reference cms_keyword", | |
+ requires = IS_ONE_OF(db,"cms_keyword.id")), | |
+ Field("resource"), | |
+ Field("record_uuid", | |
+ type=s3uuid, | |
+ length=128), | |
+ *s3.meta_fields()) | |
+ | |
+ self.configure(tablename, | |
+ list_fields=[ "id", | |
+ "keyword" | |
+ "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