Django

Code

Changeset 1275

Show
Ignore:
Timestamp:
11/17/05 09:26:50 (2 years ago)
Author:
adrian
Message:

Fixed #827 -- For admin list_display functions without a short_description, Django now converts underscores to spaces. Thanks, Aaron Swartz

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/admin/views/main.py

    r1208 r1275  
    362362                        header = func.short_description 
    363363                    except AttributeError: 
    364                         header = func.__name__ 
     364                        header = func.__name__.replace('_', ' ') 
    365365                # Non-field list_display values don't get ordering capability. 
    366366                raw_template.append('<th>%s</th>' % capfirst(header)) 
  • django/trunk/docs/tutorial02.txt

    r1262 r1275  
    332332case of the ``was_published_today`` header, because sorting by the output of 
    333333an arbitrary method is not supported. Also note that the column header for 
    334 ``was_published_today`` is, by default, the name of the method. But you can 
    335 change that by giving that method a ``short_description`` attribute:: 
     334``was_published_today`` is, by default, the name of the method (with 
     335underscores replaced with spaces). But you can change that by giving that 
     336method a ``short_description`` attribute:: 
    336337 
    337338    def was_published_today(self): 
    338339        return self.pub_date.date() == datetime.date.today() 
    339     was_published_today.short_description = 'Was published today
     340    was_published_today.short_description = 'Published today?
    340341 
    341342