Commits

Sergey Maranchuk  committed ead3061 Merge

merge with default

  • Participants
  • Parent commits 9ed18dd, ae7f650
  • Branches stable

Comments (0)

Files changed (3)

File djangobb_forum/templates/djangobb_forum/search_posts.html

 {% extends 'djangobb_forum/base.html' %}
 {% load forum_extras %}
 {% load i18n %}
+{% load pagination_tags %}
 
 {% block content %}
-{% with results as paged_qs %}
+{% autopaginate results forum_settings.FORUM_PAGE_SIZE %}
 <div class="linkst">
 	<div class="inbox">
-		<p class="pagelink">{% pagination %}</p>
+		<p class="pagelink">{% paginate %}</p>
 		<div class="clearer"></div>
 	</div>
 </div>
 {% if results %}
 {% for post in results %}
 <div class="blockpost searchposts roweven">
-	<h2>{% link post.object.topic.forum %}&nbsp;&raquo;&nbsp;{% link post.object.topic %}&nbsp;&raquo;&nbsp;<a href="{{ post.object.get_absolute_url }}">{% forum_time post.object.created %}</a></h2>
+	<h2>{% link post.object.topic.forum %}&nbsp;&raquo;&nbsp;{% link post.object.topic %}&nbsp;&raquo;&nbsp;<a href="{{ post.object.get_absolute_url }}">{% forum_time post.created %}</a></h2>
 
 	<div class="box">
 		<div class="inbox">
 				<dl>
 					<dt><strong><a href="{% url djangobb:forum_profile post.object.user %}">{{ post.object.user }}</a></strong></dt>
 					<dd>{% trans "Replies:" %} {{ post.object.topic.post_count }}</dd>
-					<dd><div class="icon"><div class="nosize"><!-- --></div></div>
-</dd>
-
+					<dd><div class="icon"><div class="nosize"><!-- --></div></div></dd>
 					<dd><p class="clearb"><a href="{{ post.object.get_absolute_url }}">{% trans "Go to post" %}</a></p></dd>
 				</dl>
 			</div>
 			<div class="postright">
 				<div class="postmsg">
 					{{ post.object.body_html|safe }}
-
 				</div>
 			</div>
 			<div class="clearer"></div>
 <div id="msg" class="block">
 	<h2><span>{% trans "Info" %}</span></h2>
 	<div class="box">
-
 		<div class="inbox">
 		<p>{% trans "Your search returned no hits." %}</p>
 		<p><a href="javascript: history.go(-1)">{% trans "Go back" %}</a></p>
 
 <div class="postlinksb">
 	<div class="inbox">
-		<p class="pagelink">{% pagination %}</p>
+		<p class="pagelink">{% paginate %}</p>
 		<div class="clearer"></div>
 	</div>
 </div>
-{% endwith %}
 {% endblock %}
 
 {% block controls %}
 					{% endif %}
 				</dl>
 {% endblock %}
-
-

File djangobb_forum/templates/djangobb_forum/search_topics.html

 <div id="msg" class="block">
 	<h2><span>{% trans "Info" %}</span></h2>
 	<div class="box">
-
 		<div class="inbox">
 		<p>{% trans "Your search returned no hits." %}</p>
 		<p><a href="javascript: history.go(-1)">{% trans "Go back" %}</a></p>

File djangobb_forum/views.py

             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):
                     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()