Hi Django users,
I have a project made of several app and I am adding a 'search' app
which provides searching facilities across all apps. Each app whose
content can be searched needs to register with the search app with
code such as:
def search_genf(request, search_terms):
# generate weighed results
from project.search import register
register('Category name', search_genf)
My question is: how should I make an app register?
At the moment, I am putting the registering code in app/__init__.py,
which is automatically run when the server starts, but I don't know if
this is a good idea. My other idea was to add a 'search.py' file to
each searchable app, and have code such as this is search/
__init__.py :
for app in settings.INSTALLED_APP:
# if app has file search.py, import it and register its search
function(s)
However, I feel like I am not doing it right.
What, in your opinion, would be a good way to go about doing this?
--
Arnaud
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---