summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgnowgi <nagarjun@gnowledge.org>2012-07-10 04:23:27 -0700
committergnowgi <nagarjun@gnowledge.org>2012-07-10 04:23:27 -0700
commitbe4ded863eaf69cf6080f39ede26c8b343e0fecf (patch)
treea48fde2a2a11bc16ce0eaa7c34aaffd065042e82
parentc880d7f66b4fdbdb6369eefb55d8bbe912bcc66e (diff)
parent784e62d0c38fbf0cc4b5e67e26354b0e0a261fc2 (diff)
downloadgnowsys-be4ded863eaf69cf6080f39ede26c8b343e0fecf.tar.gz
Merge pull request #68 from Dhiru/master
changes done in gstudio_tags.py to eliminate the error: too many sql connections
-rw-r--r--gstudio/templatetags/gstudio_tags.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/gstudio/templatetags/gstudio_tags.py b/gstudio/templatetags/gstudio_tags.py
index 47dbbff..5c3c8a8 100644
--- a/gstudio/templatetags/gstudio_tags.py
+++ b/gstudio/templatetags/gstudio_tags.py
@@ -217,6 +217,17 @@ 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]
+
+ return {'template': template,
+ 'comments': comments}
+
+
+@register.inclusion_tag('gstudio/tags/dummy.html')
+def get_recent_oldcomments(number=5, template='gstudio/tags/recent_comments.html'):
+ """Return the most recent comments"""
+ # Using map(smart_unicode... fix bug related to issue #8554
nodetype_published_pks = map(smart_unicode,
Nodetype.published.values_list('id', flat=True))
content_type = ContentType.objects.get_for_model(Nodetype)
@@ -229,7 +240,6 @@ def get_recent_comments(number=5, template='gstudio/tags/recent_comments.html'):
return {'template': template,
'comments': comments}
-
@register.inclusion_tag('gstudio/tags/dummy.html')
def get_recent_linkbacks(number=5,
template='gstudio/tags/recent_linkbacks.html'):