neptune/core/views/ui/tables.py

65 lines
1.5 KiB
Python
Raw Normal View History

2022-08-10 19:40:58 +00:00
from django.conf import settings
2022-08-10 21:40:54 +00:00
from django_tables2 import Column, Table
2022-08-11 07:53:54 +00:00
from django_tables2.columns.base import BoundColumn
# Make the table column headings lowercase
orig_Column_header = BoundColumn.header
2022-08-11 07:53:54 +00:00
@property
2022-08-11 06:22:22 +00:00
def format_header(self):
2022-08-11 07:53:54 +00:00
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
2022-08-11 06:22:22 +00:00
BoundColumn.header = format_header
2022-08-10 21:40:54 +00:00
2022-08-09 08:04:31 +00:00
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()
2022-08-11 06:22:22 +00:00
date = Column()
time = Column()
2022-08-09 08:04:31 +00:00
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()
2022-08-10 19:35:34 +00:00
exemption = Column()
num_chans = Column()
num_users = Column()
template_name = "ui/drilldown/table_results.html"
2022-08-10 19:40:58 +00:00
paginate_by = settings.DRILLDOWN_RESULTS_PER_PAGE