Monkey patch header names
This commit is contained in:
parent
6e25881c73
commit
54f82f772b
|
@ -1,5 +1,27 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django_tables2 import Column, Table
|
from django_tables2 import Column, Table
|
||||||
|
from django_tables2.columns.base import BoundColumn
|
||||||
|
|
||||||
|
# Make the table column headings lowercase
|
||||||
|
orig_Column_header = BoundColumn.header
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lower_header(self):
|
||||||
|
header = orig_Column_header.__get__(self)
|
||||||
|
header = header.lower()
|
||||||
|
header = header.title()
|
||||||
|
if header != "Ident":
|
||||||
|
header = header.replace("Id", "ID")
|
||||||
|
header = header.replace("id", "ID")
|
||||||
|
if header == "Ts":
|
||||||
|
header = "TS"
|
||||||
|
header = header.replace("Nsfw", "NSFW")
|
||||||
|
|
||||||
|
return header
|
||||||
|
|
||||||
|
|
||||||
|
BoundColumn.header = lower_header
|
||||||
|
|
||||||
|
|
||||||
class DrilldownTable(Table):
|
class DrilldownTable(Table):
|
||||||
|
|
Loading…
Reference in New Issue