mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Adds a reasonably feature complete implementation of full text search using the built in PostgreSQL engine. It uses public APIs from Expression and Lookup. With thanks to Tim Graham, Simon Charettes, Josh Smeaton, Mikey Ariel and many others for their advice and review. Particular thanks also go to the supporters of the contrib.postgres kickstarter.
20 lines
672 B
Python
20 lines
672 B
Python
from django.apps import AppConfig
|
|
from django.db.backends.signals import connection_created
|
|
from django.db.models import CharField, TextField
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from .lookups import SearchLookup, Unaccent
|
|
from .signals import register_hstore_handler
|
|
|
|
|
|
class PostgresConfig(AppConfig):
|
|
name = 'django.contrib.postgres'
|
|
verbose_name = _('PostgreSQL extensions')
|
|
|
|
def ready(self):
|
|
connection_created.connect(register_hstore_handler)
|
|
CharField.register_lookup(Unaccent)
|
|
TextField.register_lookup(Unaccent)
|
|
CharField.register_lookup(SearchLookup)
|
|
TextField.register_lookup(SearchLookup)
|