Skip to content

Commit 9baef75

Browse files
committed
added a REQUIRED_HAYSTACK_CONNECTIONS to settings of applications in order to define dedicated indexes
1 parent 918cec8 commit 9baef75

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# These apps will automatically be added to the INSTALLED_APPS
22
# of a Djity instance that uses this Djity application
33
REQUIRED_APPS = []
4+
5+
# These haystack connections will automatically be added to the HAYSTACK_CONNECTIONS
6+
# of a Djity instance that uses this Djity application
7+
# this parameter is only useful for applications that require dedicated indexes,
8+
# if you only wish to index the content of your application to be searchable in djity integrated search engine just have a look at search_indexes.py
9+
10+
REQUIRED_HAYSTACK_CONNECTIONS = {{}}

djity/project_skeleton/settings.py_tmpl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,15 @@ for app in DJITY_APPS:
273273
try:
274274
required_apps = import_module(app+'.settings').REQUIRED_APPS
275275
INSTALLED_APPS += required_apps
276+
info("REQUIRED_APPS parameter found in %s.settings, add \"%s\" to list of INSTALLED_APPS" % (app,",".join(required_apps)))
276277
except:
277-
warn("no REQUIRED_APPS parameter found in %s.settings" % app)
278-
continue
278+
pass
279+
try:
280+
required_haystack_connections = import_module(app+'settings').REQUIRED_HAYSTACK_CONNECTIONS
281+
HAYSTACK_CONNECTIONS.update(required_haystack_connections)
282+
info("REQUIRED_HAYSTACK_CONNECTIONS parameter found in %s.settings, add \"%s\" to dictionary of HAYSTACK_CONNECTIONS" % (app,",".join(required_haystack_connections.keys)))
283+
except:
284+
pass
279285

280286
# import and overwrite all settings defined locally
281287
try:

0 commit comments

Comments
 (0)