X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/05ce0b5f9bd62d1b369a6718bec1b70e0a4a0fef..34511b8161f4fa25634a9659137a1143a1511c21:/forum/urls.py diff --git a/forum/urls.py b/forum/urls.py index a0135fb..309e9a7 100644 --- a/forum/urls.py +++ b/forum/urls.py @@ -1,4 +1,8 @@ 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 @@ -6,4 +10,14 @@ from .views import AddPostView, EditPostView urlpatterns = patterns('', url(r'^forum/(?P\d+)/topic/add/$', AddPostView.as_view()), url(r'^post/(?P\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