Is Haystack incompatible with Django 1.4?

I just updated my django to 1.4. I have problems with the haystack application. In addition, I tried to upgrade haystack to the latest stable version, but I still have problems. Has anyone had the thesis of mistakes? How can I solve it?

I get the following errors.

When I access any page:

cannot import name MAX_SHOW_ALL_ALLOWED haystack\admin.py in <module>, line 2 

and

 # python manage.py rebuild_index django.core.exceptions.ImproperlyConfigured: Error importing template source loader django.template.loaders.app_directories.load_template_source: "'module' object has no attri bute 'load_template_source'" 

thanks

+7
source share
1 answer

There is a problem in the haystack / admin.py file. Try the following:

  • remove import for MAX_SHOW_ALL_ALLOWED
  • before the SearchChangeList class add a method:

     def list_max_show_all(changelist): """ Returns the maximum amount of results a changelist can have for the "Show all" link to be displayed in a manner compatible with both Django 1.4 and 1.3. See Django ticket #15997 for details. """ try: # This import is available in Django 1.3 and below from django.contrib.admin.views.main import MAX_SHOW_ALL_ALLOWED return MAX_SHOW_ALL_ALLOWED except ImportError: return changelist.list_max_show_all 
  • in SearchChangeList.get_results() change can_show_all to

     can_show_all = result_count <= list_max_show_all(self) 

Check this box for more information about this issue.

+6
source

All Articles