Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make sure column names are always titlized #368

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions django_tables2/columns/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ def header(self):
# favour Column.header
column_header = self.column.header
if column_header:
return column_header
return title(column_header)
# fall back to automatic best guess
return self.verbose_name
return title(self.verbose_name)

@property
def order_by(self):
Expand Down Expand Up @@ -434,7 +434,7 @@ def verbose_name(self):

# This is our reasonable fallback, should the next section not result
# in anything useful.
name = title(self.name.replace('_', ' '))
name = self.name.replace('_', ' ')
Copy link
Owner

@jieter jieter Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this change is applied, the second part of the first sentence of the docstring of this method is not true anymore. Please look carefully at the docstrings too when modifying these kinds of things.


# Try to use a model field's verbose_name
if hasattr(self.table.data, 'queryset') and hasattr(self.table.data.queryset, 'model'):
Expand Down