msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-11-19 15:57+0100\n"
+"POT-Creation-Date: 2013-09-04 13:32+0200\n"
"PO-Revision-Date: 2012-11-19 15:58+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "The page you were looking for doesn't exist."
msgstr "Strona której szukasz nie została znaleziona."
+#: templates/base_forum.html:7
+msgid "Forum search"
+msgstr "Szukaj na forum"
+
display: inline; }
.forum-body {
+ position: relative;
/* --- Unread --- */
/* --- Moderation --- */
/* --- Mini pagination --- */ }
+ .forum-body .search-result em {
+ background-color: yellow; }
.forum-body .pagination ul {
margin: 0;
padding: 0;
.forum-body {
+
+ position: relative;
+
+ .search-result {
+ em {
+ background-color: yellow;
+ }
+ }
+
.pagination {
ul {
margin: 0;
{% extends "base.html" %}
+{% load i18n %}
{% block body %}
<div class="forum-body">
{% block breadcrumb %}{% endblock %}
+ <a href="{% url 'forum_search' %}" style="position: absolute; top: 0; right: 5px;">{% trans 'Forum search' %}</a>
{% block content %}{% endblock %}
</div>
{% endblock %}
--- /dev/null
+from haystack import indexes
+from pybb.models import Post
+
+
+class PostIndex(indexes.SearchIndex, indexes.Indexable):
+ text = indexes.CharField(document=True, use_template=True)
+
+ def get_model(self):
+ return Post
--- /dev/null
+{% extends 'pybb/base.html' %}
+{% load i18n %}
+
+
+{% block content %}
+
+ <h1>{% trans 'Search' %}</h1>
+ <form method="get">
+ {{form.q}}
+ <tr>
+ <td> </td>
+ <td>
+ <input type="submit" value="{% trans 'Search' %}">
+ </td>
+ </tr>
+ </form>
+
+ {% if query %}
+ <hr/>
+ {% for result in page.object_list %}
+ <p class="search-result">
+ <strong>Temat:</strong> <a href="{{ result.object.get_absolute_url }}">{{ result.object.topic.name }}</a><br/>
+ {% autoescape off %}
+ {% for snippet in result.highlighted.text %}
+ {{snippet}}{% if not forloop.last %} <strong>...</strong> {% endif %}
+ {% endfor %}
+ {% endautoescape %}
+ </p>
+ {% empty %}
+ <p>Brak wyników.</p>
+ {% endfor %}
+
+ {% if page.has_previous or page.has_next %}
+ <div>
+ {% if page.has_previous %}<a href="?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}« Poprzednie{% if page.has_previous %}</a>{% endif %}
+ |
+ {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Następne »{% if page.has_next %}</a>{% endif %}
+ </div>
+ {% endif %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file
--- /dev/null
+{{object.body_text}}
\ No newline at end of file
from django.conf.urls import patterns, include, url
+from haystack.query import SearchQuerySet
+from haystack.views import SearchView, search_view_factory
+from haystack.forms import SearchForm
+from pybb.models import Post
from .views import AddPostView, EditPostView
urlpatterns = patterns('',
url(r'^forum/(?P<forum_id>\d+)/topic/add/$', AddPostView.as_view()),
url(r'^post/(?P<pk>\d+)/edit/$', EditPostView.as_view()),
-)
\ No newline at end of file
+)
+
+PostsSearchQuerySet = SearchQuerySet().models(Post).highlight()
+
+urlpatterns += patterns('haystack.views',
+ url(r'^szukaj/$', search_view_factory(
+ view_class = SearchView,
+ template = 'forum/search_results.html',
+ searchqueryset = PostsSearchQuerySet,
+ form_class = SearchForm
+ ), name='forum_search'))
\ No newline at end of file