neptune/core/views/ui/tables.py

65 lines
1.5 KiB
Python

from django.conf import settings
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 format_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 = format_header
class DrilldownTable(Table):
id = Column()
host = Column()
ident = Column()
nick = Column()
nick_id = Column()
user_id = Column()
msg = Column()
msg_id = Column()
net = Column()
net_id = Column()
num = Column()
src = Column()
ts = Column()
date = Column()
time = Column()
type = Column()
bot = Column()
channel = Column()
channel_category = Column()
channel_category_id = Column()
channel_category_nsfw = Column()
channel_id = Column()
channel_nsfw = Column()
guild_member_count = Column()
guild = Column()
guild_id = Column()
mode = Column()
modearg = Column()
sentiment = Column()
status = Column()
user = Column()
version_sentiment = Column()
exemption = Column()
num_chans = Column()
num_users = Column()
template_name = "ui/drilldown/table_results.html"
paginate_by = settings.DRILLDOWN_RESULTS_PER_PAGE