Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#4442 closed (fixed)

[unicode] Error when going to add page in admin

Reported by: Esaj Owned by: Adrian Holovaty
Component: contrib.admin Version: other branch
Severity: Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 272, in run
    self.result = application(self.environ, self.start_response)

  File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 614, in __call__
    return self.application(environ, start_response)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 111, in get_response
    return debug.technical_500_response(request, *sys.exc_info())

  File "/usr/lib/python2.5/site-packages/django/views/debug.py", line 139, in technical_500_response
    return HttpResponseServerError(t.render(c), mimetype='text/html')

  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 181, in render
    return self.nodelist.render(context, encoding)

  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 746, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 764, in render_node
    result = node.render(context)

  File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py", line 126, in render
    nodelist.append(node.render(context))

  File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py", line 213, in render
    return self.nodelist_true.render(context)

  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 746, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 774, in render_node
    raise wrapped

TemplateSyntaxError: Caught an exception while rendering: sequence item 2: expected string or Unicode, __proxy__ found

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 764, in render_node
    result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py", line 126, in render
    nodelist.append(node.render(context))
  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 800, in render
    return self.filter_expression.resolve(context)
  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 585, in resolve
    obj = resolve_variable(self.var, context)
  File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 710, in resolve_variable
    current = force_unicode(current)
  File "/usr/lib/python2.5/site-packages/django/utils/encoding.py", line 34, in force_unicode
    s = unicode(s)
  File "/usr/lib/python2.5/site-packages/django/utils/functional.py", line 54, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)
  File "/usr/lib/python2.5/site-packages/django/utils/translation/__init__.py", line 67, in string_concat
    return real_string_concat(*strings)
  File "/usr/lib/python2.5/site-packages/django/utils/translation/trans_null.py", line 16, in <lambda>
    string_concat = lambda *strings: u''.join([smart_unicode(el) for el in strings])
TypeError: sequence item 2: expected string or Unicode, __proxy__ found

The model in question:

class Customer(models.Model):
    """A customer."""
    name = models.CharField(maxlength=256)
    sites = models.ManyToManyField(Site)

    objects = models.Manager()
    on_site = CurrentSiteManager('sites')

    def __unicode__(self):
        return self.name

    class Admin:
        list_display = ('name',)
        search_fields = ('name',)

    class Meta:
        ordering = ('name',)

Change History (2)

comment:1 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [5390]) unicode: Fixed #4442 -- Fixed a problem with string_concat() when
USE_I18N=False.

comment:2 by Esaj, 18 years ago

Wow, quick response! :-)

Note: See TracTickets for help on using tickets.
Back to Top