def get_context(self, context, obj): object_id = obj.pk content_type_id = '%s.%s' % (obj._meta.app_label, obj._meta.module_name) query = {DJANGO_ID: object_id, DJANGO_CT: content_type_id} output_context = { 'haystack_settings': get_haystack_settings(), } try: result = SearchQuerySet().filter(**query)[:1][0] result = SearchResultWrapper(obj=result) output_context.update(original=result) except IndexError: pass return output_context
def get_settings(self): """Find all Django settings prefixed with ``HAYSTACK_`` :return: dictionary whose keys are setting names (tidied up). """ return get_haystack_settings()