neptune/core/views/ui/tables.py

83 lines
1.9 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()
2022-08-18 06:20:30 +00:00
# version_sentiment = Column()
2022-08-10 19:35:34 +00:00
exemption = Column()
num_chans = Column()
num_users = Column()
2022-08-11 06:22:22 +00:00
online = Column()
2022-08-11 21:45:02 +00:00
mtype = Column()
realname = Column()
server = Column()
2022-08-09 06:20:30 +00:00
mtype = Column()
2022-10-04 20:47:37 +00:00
tokens = Column()
2022-09-27 14:15:08 +00:00
lang_code = Column()
lang_name = Column()
2022-10-04 20:47:37 +00:00
# words_noun = Column()
# words_adj = Column()
# words_verb = Column()
# words_adv = Column()
hidden = Column()
2022-08-30 09:37:41 +00:00
filename = Column()
2022-08-30 11:55:33 +00:00
file_md5 = Column()
file_ext = Column()
file_size = Column()
2022-08-30 09:37:41 +00:00
template_name = "ui/drilldown/table_results.html"
2022-08-10 19:40:58 +00:00
paginate_by = settings.DRILLDOWN_RESULTS_PER_PAGE