1. tghw
  2. lithium

Commits

Kyle Fuller  committed 39cd2d6

forum: Add a vanillaforum style all threads list

  • Participants
  • Parent commits e5507d4
  • Branches default

Comments (0)

Files changed (2)

File lithium/forum/urls.py

View file
  • Ignore whitespace
 
 urlpatterns = patterns('lithium.forum.views',
     url(r'^$', 'forum_index', name='forum.forum_index'),
+    url(r'^threads/$', 'thread_list', name='forum.threads'),
     url(r'^(?P<forum>[-\w]+)/$', 'forum_detail', name='forum.forum_detail'),
     url(r'^(?P<forum>[-\w]+)/create/$', 'thread_create', name='forum.thread_create'),
     url(r'^(?P<forum>[-\w]+)/(?P<slug>[-\w]+)/$', 'thread_detail', name='forum.thread_detail'),

File lithium/forum/views.py

View file
  • Ignore whitespace
         template_object_name='thread'
     )
 
+def thread_list(request):
+    user_permission = user_permission_level(request.user)
+    return object_list(request,
+        queryset=Thread.objects.filter(forum__read__lte=user_permission),
+        paginate_by=settings.FORUM_THREAD_PAGINATE_BY,
+        template_object_name='thread'
+    )
+
 def thread_create(request, forum):
     user_permission = user_permission_level(request.user)