Saturday, June 26, 2010

Error using inline displays with a user profile

I am having some problems with inline displays, since I upgraded to
1.2. The example here seems representative so I present as much
information as seems relevant.

I have set up the user & userprofile in a standard way - as per the
"recipe" given by James Bennett here:
http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
and Matt's supplemental blog entry here:
http://www.thenestedfloat.com/articles/displaying-custom-user-profile-fields-in-djangos-admin

I have also checked that the userprofile table I use (basically the
old user table from the previous system, with an extra field added to
link it to the new auth_user) already contains all the data I want to
display/edit.

However, when I try and edit a user I get this error (which seems
related to the inline display somehow):

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/auth/user/1/
Django Version: 1.2.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'sorl.thumbnail',
'project.edit']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'edit.middleware.threadlocals.ThreadLocals')

Template error:
In template /project/edit/templates/admin/edit_inline/stacked.html,
error at line 8
Caught TypeError while rendering: coercing to Unicode: need string
or buffer, NoneType found
1 : {% load i18n adminmedia %}
2 : <div class="inline-group"
id="{{ inline_admin_formset.formset.prefix }}-group">
3 : <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}
</h2>
4 : {{ inline_admin_formset.formset.management_form }}
5 : {{ inline_admin_formset.formset.non_form_errors }}
6 :
7 : {% for inline_admin_form in inline_admin_formset %}<div
class="inline-related{% if forloop.last %} empty-form last-related{%
endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not
forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
8 : <h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</
b>&nbsp;<span class="inline_label">{% if inline_admin_form.original %}
{{ inline_admin_form.original }} {% else %}#{{ forloop.counter }}{%
endif %}</span>


On the webpage, the {{ inline_admin_form.original }} is displayed in
red.

I have had this error in other places as well, but this seems the one
that is most easily reproducible.

Thanks
Derek

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment