Commits

Anonymous committed 6a36aec

mychanges

  • Participants
  • Parent commits 4ed014f

Comments (0)

Files changed (2)

djangobb/djangobb_forum/templatetags/forum_extras.py

     limit = '10'
     category = '0'
     order_by='"created"'
+    forum = '0'
 
     if match.group(2):
         args = dict([x.strip().split('=') for x in match.group(2).split(',')])
             category = args['category']
         if 'order_by' in args:
             order_by = args['order_by']
+        if 'forum' in args:
+            forum = args['forum']
 
-    return DjangobbLoadLastTopicsNode(name, limit, category, order_by)
+    return DjangobbLoadLastTopicsNode(name, limit, category, order_by, forum)
 
 class DjangobbLoadLastTopicsNode(template.Node):
-    def __init__(self, name, limit, category, order_by):
+    def __init__(self, name, limit, category, order_by, forum):
         self.name = name
         self.limit = template.Variable(limit)
         self.category = template.Variable(category)
         self.order_by = template.Variable(order_by)
+        self.forum = template.Variable(forum)
 
     def render(self, context):
         limit = self.limit.resolve(context)
         category = self.category.resolve(context)
         order_by = self.order_by.resolve(context)
+        forum = self.order_by.resolve(context)
         topics = Topic.objects.all().select_related().order_by('-' + order_by)
         if category:
             topics = topics.filter(forum__category__pk=category)
+        if forum and forum.isdigit():
+            topics = topics.filter(forum=forum)
         context[self.name] = topics[:limit]
         return ''

djangobb/djangobb_forum/util.py

 
 def convert_text_to_html(text, markup):
     if markup == 'bbcode':
-        text = render_bbcode(text)
+        from mypostmarkup import markup
+        #self.body_html = markup(self.body)
+        #text = render_bbcode(text)
+        text = markup(text)
     elif markup == 'markdown':
         text = markdown.markdown(text, safe_mode='escape')
     else: