7

I just upgradated my django to 1.4. I am getting trouble with haystack app. Also, I tried to update haystack to last stable version but I still having problems. Does anyone had theses errors? How can I solve it?

I am getting 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

agf
  • 171,228
  • 44
  • 289
  • 238
Thomas
  • 2,256
  • 6
  • 32
  • 47

1 Answers1

6

there is a problem in haystack/admin.py file. Try to do the following:

  1. remove import for MAX_SHOW_ALL_ALLOWED
  2. before class SearchChangeList add 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
    
  3. in SearchChangeList.get_results() change can_show_all to

    can_show_all = result_count <= list_max_show_all(self)
    

Check this thread for more background info on the issue.

mac
  • 42,153
  • 26
  • 121
  • 131
szaman
  • 6,666
  • 13
  • 53
  • 81