On Mon, Aug 30, 2010 at 4:13 PM, christian.oudard < christian.oud...@gmail.com> wrote:
> On Django 1.2, I'm getting a missing template variable when using a > custom formatter in the django admin. > > Here is my admin class: > > class CustomerAdmin(admin.ModelAdmin): > fields = [ > 'name', > ] > list_display = [ > 'name', > 'customer_tenants', > ] > def customer_tenants(self, customer): > return u', '.join(t.subdomain for t in > customer.tenant_set.all()) > customer_tenants.short_description = 'Tenants' > > The error seems to be the same one as in this ticket: > http://code.djangoproject.com/ticket/2583 > > Looking at the template from the admin app, the header.class_attrib > seems to be missing. This is generated internally by django. > > I can fix the error by changing the template admin/ > change_list_results.html by putting an if statement around the > {{ header.class_attrib }} variable: > > {% for header in result_headers %}<th{% if header.class_attrib %} > {{ header.class_attrib }}{% endif %}> > > Is this an error due to improper configuration or due to a bug in > django? > Do you have TEMPLATE_STRING_IF_INVALID set to something? That is documented to be only for temporary debug purposes: http://docs.djangoproject.com/en/dev/ref/templates/api/#invalid-template-variables. Attempting to use the admin with TEMPLATE_STRING_IF_INVALID set to something other than the empty string is not a good idea -- admin is one of the specific apps noted as relying on the default value of an empty string for invalid variable references in templates. Karen -- http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.