@@ -12,17 +12,15 @@ deleting objects in a Haystack_ search index.
12
12
Requirements
13
13
------------
14
14
15
- * Django 1.4 +
16
- * Haystack _ `1.2.X `_ * or * ` 2.X `_
15
+ * Django 1.8 +
16
+ * Haystack _ `2.X `_
17
17
* Celery _ 3.X
18
18
19
19
You also need to install your choice of one of the supported search engines
20
20
for Haystack and one of the supported backends for Celery.
21
21
22
22
23
23
.. _Haystack : http://haystacksearch.org
24
- .. _`1.2.X` : http://pypi.python.org/pypi/django-haystack/1.2.5
25
- .. _`2.X` : https://github.com/toastdriven/django-haystack/tree/master
26
24
27
25
Installation
28
26
------------
@@ -31,52 +29,17 @@ Use your favorite Python package manager to install the app from PyPI, e.g.::
31
29
32
30
pip install celery-haystack
33
31
34
- By default a few dependencies will automatically be installed:
35
32
36
- - django-appconf _ -- An app to gracefully handle application settings.
37
-
38
- - `django-celery-transactions `_ -- An app that "holds on to Celery tasks
39
- until the current database transaction is committed, avoiding potential
40
- race conditions as described in `Celery's user guide `_."
33
+ For Django < 1.9 you need to install `django-transaction-hooks `_ -- an app that
34
+ brings transaction commit hooks to Django.
41
35
42
36
.. _django-appconf : http://pypi.python.org/pypi/django-appconf
43
- .. _`django-celery-transactions ` : https://github.com/chrisdoble /django-celery-transactions
44
- .. _ `Celery's user guide` : http://celery.readthedocs.org/en/latest/userguide/tasks.html#database-transactions
37
+ .. _`django-transaction-hooks ` : https://github.com/carljm /django-transaction-hooks
38
+
45
39
46
40
Usage
47
41
-----
48
42
49
- Haystack 1.X
50
- ~~~~~~~~~~~~
51
-
52
- 1. Add ``'celery_haystack' `` to the ``INSTALLED_APPS `` setting
53
-
54
- .. code :: python
55
-
56
- INSTALLED_APPS = [
57
- # ..
58
- ' celery_haystack' ,
59
- ]
60
-
61
- 2. Alter all of your ``SearchIndex `` subclasses to inherit from
62
- ``celery_haystack.indexes.CelerySearchIndex ``
63
-
64
- .. code :: python
65
-
66
- from haystack import site, indexes
67
- from celery_haystack.indexes import CelerySearchIndex
68
- from myapp.models import Note
69
-
70
- class NoteIndex (CelerySearchIndex ):
71
- text = indexes.CharField(document = True , model_attr = ' content' )
72
-
73
- site.register(Note, NoteIndex)
74
-
75
- 3. Ensure your Celery instance is running.
76
-
77
- Haystack 2.X
78
- ~~~~~~~~~~~~
79
-
80
43
1. Add ``'celery_haystack' `` to the ``INSTALLED_APPS `` setting
81
44
82
45
.. code :: python
0 commit comments