fix #224: Exception when using show_as=posts
This commit is contained in:
parent
0a0885a7eb
commit
079aab7c29
3 changed files with 8 additions and 14 deletions
djangobb_forum
|
@ -174,6 +174,7 @@ def search(request):
|
|||
if 'topics' in request.GET['show_as']:
|
||||
topics = []
|
||||
topics_to_exclude = SQ()
|
||||
#TODO: rewrite
|
||||
for post in posts:
|
||||
if post.object.topic not in topics:
|
||||
if post.object.topic.forum.category.has_access(request.user):
|
||||
|
@ -185,7 +186,7 @@ def search(request):
|
|||
posts = posts.exclude(topics_to_exclude)
|
||||
return render(request, 'djangobb_forum/search_topics.html', {'results': topics})
|
||||
elif 'posts' in request.GET['show_as']:
|
||||
return render(request, 'djangobb_forum/search_posts.html', {'results': topics})
|
||||
return render(request, 'djangobb_forum/search_posts.html', {'results': posts})
|
||||
return render(request, 'djangobb_forum/search_topics.html', {'results': topics})
|
||||
else:
|
||||
form = PostSearchForm()
|
||||
|
|
Reference in a new issue