drugs/core/views/ui/tables.py

44 lines
1.0 KiB
Python
Raw Normal View History

2024-03-26 17:06:44 +00:00
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"
# if header == "Match Ts":
# header = "Match TS"
# header = header.replace("Nsfw", "NSFW")
# return header
# BoundColumn.header = format_header
class DrugsTable(Table):
id = Column()
name = Column()
drug_class = Column()
common_name = Column()
links = Column()
dosages = Column()
timings = Column()
effects = Column()
actions = Column()
experiences = Column()
template_name = "ui/search/table_results.html"
paginate_by = settings.DRUGS_RESULTS_PER_PAGE