--- /dev/null
+from haystack import indexes
+
+from .models import Emission, Episode
+
+
+class EmissionIndex(indexes.SearchIndex, indexes.Indexable):
+ text = indexes.CharField(document=True, use_template=True)
+
+ def get_model(self):
+ return Emission
+
+
+class EpisodeIndex(indexes.SearchIndex, indexes.Indexable):
+ text = indexes.CharField(document=True, use_template=True)
+
+ def get_model(self):
+ return Episode
+
--- /dev/null
+{{ object.title }}
+
+{{ object.description|striptags }}
+
+{{ object.text|striptags }}
--- /dev/null
+{{ object.title }}
+
+{{ object.description|striptags }}
+
+{{ object.text|striptags }}
'django.contrib.staticfiles',
'django.contrib.admin',
'ckeditor',
+ 'haystack',
'panikdb.emissions',
)
},
}
+HAYSTACK_CONNECTIONS = {
+ 'default': {
+ 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
+ 'URL': 'http://127.0.0.1:8080/solr'
+ },
+}
try:
from local_settings import *
--- /dev/null
+{% extends 'panikdb/base.html' %}
+
+{% block content %}
+ <h2>Recherche</h2>
+
+ <form method="get" action=".">
+ <table>
+ {{ form.as_table }}
+ <tr>
+ <td> </td>
+ <td>
+ <input type="submit" value="Rechercher">
+ </td>
+ </tr>
+ </table>
+
+ {% if query %}
+ <h3>Résultats</h3>
+
+ {% for result in page.object_list %}
+ <p>
+ <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a>
+ </p>
+ {% empty %}
+ <p>Aucun résultat trouvé.</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 %}« Précédente{% if page.has_previous %}</a>{% endif %}
+ |
+ {% if page.has_next %}<a href="?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Suvante »{% if page.has_next %}</a>{% endif %}
+ </div>
+ {% endif %}
+ {% else %}
+ {# Show some example queries to run, maybe query syntax, something else? #}
+ {% endif %}
+ </form>
+{% endblock %}
from django.contrib import admin
admin.autodiscover()
+from haystack.views import SearchView, search_view_factory
+from haystack.forms import SearchForm
+
urlpatterns = patterns('',
# url(r'^$', 'panikdb.views.home', name='home'),
(r'^ckeditor/', include('ckeditor.urls')),
+ url(r'^search/', search_view_factory(view_class=SearchView, form_class=SearchForm), name='haystack_search'),
url(r'^panikdb/', include('panikdb.emissions.urls')),
url(r'^admin/', include(admin.site.urls)),
Django<1.6
django-ckeditor
+git+https://github.com/toastdriven/django-haystack.git