﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12841	"In admin options class, blank short_description causes ""string index out of range"" exception"	Greg Brown	nobody	"'''Example admin.py:'''

{{{
from models import MyModel
from django.contrib import admin

class MyModelAdmin(admin.ModelAdmin):
    list_display = ('name', 'my_custom_method', )
    
    def my_custom_method(self, instance):
        return 'custom text'

    my_custom_method.short_description = ''

admin.site.register(MyModel, MyModelAdmin)
}}}


'''Descripion'''

This admin classes changelist seems to throw a TemplateSyntaxError when trying to prettify the short description (which I'd have thought shouldn't really be happening; the point of short description in this context is to customise the column header, which by default is created by prettifying the function name)

The full traceback is


{{{
Original Traceback (most recent call last):
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/debug.py"", line 72, in render_node
    result = node.render(context)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/__init__.py"", line 945, in render
    dict = func(*args)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templatetags/admin_list.py"", line 194, in result_list
    'result_headers': list(result_headers(cl)),
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templatetags/admin_list.py"", line 91, in result_headers
    header = pretty_name(header)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/forms/forms.py"", line 22, in pretty_name
    name = name[0].upper() + name[1:]
IndexError: string index out of range

}}}


"		closed	contrib.admin	1.2-beta		duplicate			Accepted	0	0	0	0	0	0
