telemeta.util.search_router module
from haystack.routers import BaseRouter from telemeta.models.instrument import Instrument, InstrumentAlias from telemeta.models.location import LocationAlias, Location #Router in order to determine #that autocomplete data are stored in "autocomplete" index class AutoRouter(BaseRouter): def for_write(self, **hints): obj = hints.get('instance') if isinstance(obj, Instrument) or isinstance(obj, InstrumentAlias) or isinstance(obj, Location) \ or isinstance(obj, LocationAlias): return 'autocomplete' else: return None
Classes
class AutoRouter
class AutoRouter(BaseRouter): def for_write(self, **hints): obj = hints.get('instance') if isinstance(obj, Instrument) or isinstance(obj, InstrumentAlias) or isinstance(obj, Location) \ or isinstance(obj, LocationAlias): return 'autocomplete' else: return None
Ancestors (in MRO)
- AutoRouter
- haystack.routers.BaseRouter
- __builtin__.object
Methods
def for_write(
self, **hints)
def for_write(self, **hints): obj = hints.get('instance') if isinstance(obj, Instrument) or isinstance(obj, InstrumentAlias) or isinstance(obj, Location) \ or isinstance(obj, LocationAlias): return 'autocomplete' else: return None