Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Using force_text for indexing message #746

merged 2 commits into from

3 participants


verbose_name_plural can be a functional proxy object as it is possible to use ugettext_lazy for it, if you wouldn't use force_text, the output would be:

All documents removed.
Indexing 203 <django.utils.functional.__proxy__ object at 0x30aed10>.
Indexing 19 <django.utils.functional.__proxy__ object at 0x30a1a50>.
Indexing 999 <django.utils.functional.__proxy__ object at 0x332f650>.
@lazerscience lazerscience using force_text for indexing message.
verbose_name_plural may be a functional proxy object from ugettext_lazy,
it should be forced to be a string!

force_text is the Django>1.4.5 version of force_unicode. Since the latter will be supported for a while and is the only available in older versions I suggest to use it instead.

@bigjust bigjust merged commit 0e8bd20 into django-haystack:master
@floppya floppya referenced this pull request from a commit in floppya/django-haystack
@lazerscience lazerscience replacing `force_text` with `force_unicode`. #746 4caaefd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2013
  1. @lazerscience

    using force_text for indexing message.

    lazerscience authored
    verbose_name_plural may be a functional proxy object from ugettext_lazy,
    it should be forced to be a string!
Commits on Mar 4, 2013
  1. @lazerscience
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 haystack/management/commands/
4 haystack/management/commands/
@@ -8,7 +8,7 @@
from django.core.exceptions import ImproperlyConfigured
from import LabelCommand
from django.db import reset_queries
-from django.utils.encoding import smart_str
+from django.utils.encoding import smart_str, force_unicode
from haystack import connections as haystack_connections
from haystack.query import SearchQuerySet
@@ -241,7 +241,7 @@ def update_backend(self, label, using):
total = qs.count()
if self.verbosity >= 1:
- print "Indexing %d %s." % (total, smart_str(model._meta.verbose_name_plural))
+ print "Indexing %d %s." % (total, force_unicode(model._meta.verbose_name_plural))
pks_seen = set([smart_str(pk) for pk in qs.values_list('pk', flat=True)])
batch_size = self.batchsize or backend.batch_size
Something went wrong with that request. Please try again.