Solved. You need to add "u" to the unicode representation of your model's
record. As in:
def __unicode__(self):
return u'%s' % self.fieldname
This "error" does not show up in the normal admin page for the model, only
when its accessed via the pop-up route.
On Tuesday, 19 November 2013 20:42:25 UTC+2, Derek wrote:
>
> Hi
>
> I am using Django 1.5.5. This error happens while running the dev
> server. If I click on the "+" button so I can use the pop-up form to add a
> new entry to a drop-down list (i.e. FK to another model), I get the
> following error trace when trying to save that form.
>
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>
> in get_response
> 115. response = callback(request,
> *callback_args, **callback_kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
>
> in wrapper
> 372. return self.admin_site.admin_view(view)(*args,
> **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/decorators.py"
>
> in _wrapped_view
> 91. response = view_func(request, *args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/views/decorators/cache.py"
>
> in _wrapped_view_func
> 89. response = view_func(request, *args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/sites.py"
>
> in inner
> 202. return view(request, *args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/decorators.py"
>
> in _wrapper
> 25. return bound_func(*args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/decorators.py"
>
> in _wrapped_view
> 91. response = view_func(request, *args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/decorators.py"
>
> in bound_func
> 21. return func(self, *args2, **kwargs2)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/db/transaction.py"
>
> in inner
> 223. return func(*args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
>
> in add_view
> 1010. return self.response_add(request, new_object)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
>
> in response_add
> 833. (escape(pk_value), escapejs(obj)))
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/functional.py"
>
> in wrapper
> 196. return func(*args, **kwargs)
> File
> "/home/derek/.virtualenvs/s2s/local/lib/python2.7/site-packages/django/utils/html.py"
>
> in escapejs
> 64. return mark_safe(force_text(value).translate(_js_escapes))
>
> Exception Type: TypeError at /admin/core/item/add/
> Exception Value: expected a character buffer object
>
>
> You can see there are no links to my code, so I am not sure what needs to
> change or be changed. Is it Django code itself that is faulty?
>
> Thanks
> Derek
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/6ddf3ada-7307-4156-aca1-f0e1ae7a4ad9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.