Check that your __str__/__unicode__ model's methods return strings

On 23 сент, 17:41, paulh <[EMAIL PROTECTED]> wrote:
> I select a model in the initial admin page and am offered a choice of
> the available instances/rows to change. If I either select one of
> these, or press the add button I get the following error:
> Traceback (most recent call last):
> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
> in _real_get_response
>   81. response = callback(request, *callback_args, **callback_kwargs)
> File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
> decorators.py" in _checklogin
>   55. return view_func(request, *args, **kwargs)
> File "/usr/lib/python2.4/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   39. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
> main.py" in change_stage
>   322. manipulator = model.ChangeManipulator(object_id)
> File "/usr/lib/python2.4/site-packages/django/db/models/
> manipulators.py" in __init__
>   278. super(AutomaticChangeManipulator, self).__init__(follow=follow)
> File "/usr/lib/python2.4/site-packages/django/db/models/
> manipulators.py" in __init__
>   70. self.fields.extend(f.get_manipulator_fields(self.opts, self,
> self.change))
> File "/usr/lib/python2.4/site-packages/django/db/models/fields/
> __init__.py" in get_manipulator_fields
>   277. field_objs, params =
> self.prepare_field_objs_and_params(manipulator, name_prefix)
> File "/usr/lib/python2.4/site-packages/django/db/models/fields/
> related.py" in prepare_field_objs_and_params
>   512. params['choices'] = self.get_choices_default()
> File "/usr/lib/python2.4/site-packages/django/db/models/fields/
> __init__.py" in get_choices_default
>   353. return self.get_choices()
> File "/usr/lib/python2.4/site-packages/django/db/models/fields/
> __init__.py" in get_choices
>   344. lst = [(getattr(x, self.rel.get_related_field().attname),
> smart_unicode(x)) for x in
> rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]
> File "/usr/lib/python2.4/site-packages/django/utils/encoding.py" in
> smart_unicode
>   24. return force_unicode(s, encoding, strings_only, errors)
> File "/usr/lib/python2.4/site-packages/django/utils/encoding.py" in
> force_unicode
>   39. s = unicode(str(s), encoding, errors)
>
>   TypeError at /admin/book/book/15592/
>   __str__ returned non-string (type NoneType)
>
> After looking at some of the local vars in the dump I thought it might
> be to do with null foreign keys and so I (half-heartedly) filled all
> the nulls with acceptable ids, but this made no difference.
>
> Slightly puzzled now.
>
> Paul Hide


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to