summaryrefslogtreecommitdiff
path: root/gstudio/templatetags
diff options
context:
space:
mode:
authoranujag <anujag@inspiration.(none)>2012-07-13 13:00:54 +0530
committeranujag <anujag@inspiration.(none)>2012-07-13 13:00:54 +0530
commit2d412122742571b17a4d9a3bc79f20a199c223e6 (patch)
tree24d4a963714dfbde84ebfe16ed8dd7edd1222da4 /gstudio/templatetags
parent97bd4e1f8007a6ab6b6d2f1b3a158567c61f7d72 (diff)
downloadgnowsys-2d412122742571b17a4d9a3bc79f20a199c223e6.tar.gz
CNL added
Diffstat (limited to 'gstudio/templatetags')
-rw-r--r--gstudio/templatetags/gstudio_tags.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/gstudio/templatetags/gstudio_tags.py b/gstudio/templatetags/gstudio_tags.py
index 5c3c8a8..66b5f17 100644
--- a/gstudio/templatetags/gstudio_tags.py
+++ b/gstudio/templatetags/gstudio_tags.py
@@ -23,7 +23,7 @@ from datetime import datetime
from django.db.models import Q
from django.db import connection
-from django.template import Node
+from django.template import Node as nd
from django.template import Library
from django.template import TemplateSyntaxError
from django.contrib.comments.models import CommentFlag
@@ -46,6 +46,8 @@ from gstudio.comparison import pearson_score
from gstudio.templatetags.zcalendar import GstudioCalendar
from gstudio.templatetags.zbreadcrumbs import retrieve_breadcrumbs
+from gstudio.CNL import *
+
register = Library()
VECTORS = None
@@ -217,8 +219,16 @@ def get_calendar_nodetypes(context, year=None, month=None,
def get_recent_comments(number=5, template='gstudio/tags/recent_comments.html'):
"""Return the most recent comments"""
# Using map(smart_unicode... fix bug related to issue #8554
-
- comments = get_comment_model().objects.filter(is_public=True).order_by('-submit_date')[:number]
+ #Modified comments to include CNL
+ nodetype_published_pks = map(smart_unicode,
+ Nodetype.published.values_list('id', flat=True))
+ content_type = ContentType.objects.get_for_model(Nodetype)
+
+ comments = get_comment_model().objects.filter(
+ Q(flags=None) | Q(flags__flag=CommentFlag.MODERATOR_APPROVAL),
+ content_type=content_type, object_pk__in=nodetype_published_pks,
+ is_public=True).order_by('-submit_date')[:number]
+
return {'template': template,
'comments': comments}
@@ -330,15 +340,19 @@ def get_type(name):
return get_node(name)
-class TagsNode(Node):
+class TagsNode(nd):
def __init__(self, context_var):
self.context_var = context_var
-
def render(self, context):
context[self.context_var] = tags_published()
return ''
-
-
+#define get_CNL function
+@register.assignment_tag
+def get_CNL(no, takes_context = True):
+
+ l = get_CNL_list(no)
+ return l
+
@register.tag
def get_tags(parser, token):
"""{% get_tags as var %}"""