disable cybernaut form
[edumed.git] / forum / urls.py
index a0135fb..c669808 100644 (file)
@@ -1,9 +1,26 @@
-from django.conf.urls import patterns, include, url
+# -*- coding: utf-8 -*-
+from django.conf.urls import patterns, 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
 
 
 
 from .views import AddPostView, EditPostView
 
 
-urlpatterns = patterns('',
+urlpatterns = patterns(
+    '',
     url(r'^forum/(?P<forum_id>\d+)/topic/add/$', AddPostView.as_view()),
     url(r'^post/(?P<pk>\d+)/edit/$', EditPostView.as_view()),
     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'))