Ошибка NoneType в Django 1.9 Solr Haystack

Question:

    AttributeError at /ru/search/
'NoneType' object has no attribute '_default_manager'
Request Method: GET
Request URL:    http://127.0.0.1:8000/ru/search/?q=orc
Django Version: 1.9.5
Exception Type: AttributeError
Exception Value:    
'NoneType' object has no attribute '_default_manager'
Exception Location: C:\Pyth27\lib\site-packages\haystack\query.py in post_process_results, line 219
Python Executable:  C:\Pyth27\python.exe
Python Version: 2.7.4

This error occurs when searching for an item, they say that it is related to the lack of haystack support for Django 1.9, who knows how to solve it?

  Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/ru/search/?q=orc

Django Version: 1.9.5
Python Version: 2.7.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.flatpages',
 'django.contrib.staticfiles',
 'django.contrib.sitemaps',
 'django_extensions',
 'debug_toolbar',
 'apps.gateway',
 'widget_tweaks',
 'oscar',
 'oscar.apps.analytics',
 'oscar.apps.checkout',
 'oscar.apps.address',
 'oscar.apps.shipping',
 'oscar.apps.catalogue',
 'oscar.apps.catalogue.reviews',
 'oscar.apps.partner',
 'oscar.apps.basket',
 'oscar.apps.payment',
 'oscar.apps.offer',
 'oscar.apps.order',
 'oscar.apps.customer',
 'oscar.apps.promotions',
 'oscar.apps.search',
 'oscar.apps.voucher',
 'oscar.apps.wishlists',
 'oscar.apps.dashboard',
 'oscar.apps.dashboard.reports',
 'oscar.apps.dashboard.users',
 'oscar.apps.dashboard.orders',
 'oscar.apps.dashboard.promotions',
 'oscar.apps.dashboard.catalogue',
 'oscar.apps.dashboard.offers',
 'oscar.apps.dashboard.partners',
 'oscar.apps.dashboard.pages',
 'oscar.apps.dashboard.ranges',
 'oscar.apps.dashboard.reviews',
 'oscar.apps.dashboard.vouchers',
 'oscar.apps.dashboard.communications',
 'oscar.apps.dashboard.shipping',
 'haystack',
 'treebeard',
 'sorl.thumbnail',
 'django_tables2']
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'oscar.apps.basket.middleware.BasketMiddleware')



Traceback:

File "C:\Pyth27\lib\site-packages\django\core\handlers\base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "C:\Pyth27\lib\site-packages\django\core\handlers\base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Pyth27\lib\site-packages\django\utils\decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "C:\Pyth27\lib\site-packages\haystack\views.py" in search_view
  152.         return view_class(*args, **kwargs)(request)

File "C:\Users\Artemie\workspace Web\Sandbox_release\oscar\apps\search\views.py" in __call__
  26.         response = super(FacetedSearchView, self).__call__(request)

File "C:\Pyth27\lib\site-packages\haystack\views.py" in __call__
  53.         return self.create_response()

File "C:\Pyth27\lib\site-packages\haystack\views.py" in create_response
  133.         (paginator, page) = self.build_page()

File "C:\Pyth27\lib\site-packages\haystack\views.py" in build_page
  110.         self.results[start_offset:start_offset + self.results_per_page]

File "C:\Pyth27\lib\site-packages\haystack\query.py" in __getitem__
  272.                 self._fill_cache(start, bound)

File "C:\Pyth27\lib\site-packages\haystack\query.py" in _fill_cache
  191.         to_cache = self.post_process_results(results)

File "C:\Pyth27\lib\site-packages\haystack\query.py" in post_process_results
  219.                     loaded_objects[model] = model._default_manager.in_bulk(models_pks[model])

Exception Type: AttributeError at /ru/search/
Exception Value: 'NoneType' object has no attribute '_default_manager'

Answer:

Tax solved the problem in the following way – Download https://github.com/django-haystack/django-haystack/tree/f1ed18313777005dd77ed724ecbfb27c0b03cad8 as a .zip file, drop the file into the pip directory, and then successfully pip uninstall django-haystack through the terminal uninstallation – we drive in pip install django-haystack-f1ed18313777005dd77ed724ecbfb27c0b03cad8.zip -f1ed18313777005dd77ed724ecbfb27c0b03cad8 – can be removed so that it is just django-haystack

Scroll to Top