fixed recent threads & tags links

This commit is contained in:
Rocky Duan
2012-08-22 19:09:58 -07:00
parent 99614ea302
commit 43ef4f6482
5 changed files with 25 additions and 12 deletions

View File

@@ -7,12 +7,14 @@ from django.http import HttpResponse
from django.utils import simplejson
from django.db import connection
from django.conf import settings
from django.core.urlresolvers import reverse
from django_comment_client.permissions import check_permissions_by_view
from mitxmako import middleware
import logging
import operator
import itertools
import urllib
import pystache_custom as pystache
@@ -188,6 +190,10 @@ def get_annotated_content_infos(course_id, thread, user, user_info):
annotate(thread)
return infos
# put this method in utils.py to avoid circular import dependency between helpers and mustache_helpers
def url_for_tags(course_id, tags):
return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course_id]) + '?' + urllib.urlencode({'tags': tags})
def render_mustache(template_name, dictionary, *args, **kwargs):
template = middleware.lookup['main'].get_template(template_name).source
return pystache.render(template, dictionary)