summaryrefslogtreecommitdiff
path: root/gstudio/templatetags
diff options
context:
space:
mode:
authorhorntail <nktsrd@gmail.com>2012-07-13 15:33:00 +0530
committerhorntail <nktsrd@gmail.com>2012-07-13 15:33:00 +0530
commit253a7a23f71fd90e9f70a89b6a0aad6312ef4d40 (patch)
treeaade34552216e94820c49aab0f52ad94316b8ec7 /gstudio/templatetags
parentf3dc110be252dc51d0ce938c4be655d4453de4cf (diff)
parent25261ae70442eabc1b26ddfbbd923b04a3ffb9f1 (diff)
downloadgnowsys-253a7a23f71fd90e9f70a89b6a0aad6312ef4d40.tar.gz
Merge remote-tracking branch 'gn/master'
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 ad1d7e6..c5954ab 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
@@ -47,6 +47,8 @@ from gstudio.templatetags.zcalendar import GstudioCalendar
from gstudio.templatetags.zbreadcrumbs import retrieve_breadcrumbs
from django.http import HttpResponseRedirect
+from gstudio.CNL import *
+
register = Library()
VECTORS = None
@@ -218,8 +220,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}
@@ -331,15 +341,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 %}"""