Skip to content
Snippets Groups Projects

Filtrování a provádění hromadných akcí na participants

Merged Jiří Setnička requested to merge jirka/participants into master
1 unresolved thread
1 file
+ 23
2
Compare changes
  • Side-by-side
  • Inline
+ 23
2
@@ -55,15 +55,35 @@ class CellLink(Cell):
return a + '>' + escape(self.text) + '</a>'
class CellCheckbox(Cell):
name: str
value: str
checked: bool
def __init__(self, name: str, value: str, checked: bool = False):
Cell.__init__(self, "")
self.name = name
self.value = value
self.checked = checked
def to_html(self) -> str:
ch = f'<input type="checkbox" name="{self.name}" value="{self.value}"'
if self.checked:
ch += ' checked'
return ch + '>'
class Table:
columns: Sequence[Column]
rows: Iterable[dict]
filename: str
show_downlink: bool
def __init__(self, columns: Sequence[Column], rows: Iterable[dict], filename: str):
def __init__(self, columns: Sequence[Column], rows: Iterable[dict], filename: str, show_downlink: bool = True):
self.columns = columns
self.rows = rows
self.filename = filename
self.show_downlink = show_downlink
def to_html(self) -> str:
tab = ['<table class=data>', '<tr>']
@@ -82,7 +102,8 @@ class Table:
tab.append(f'\t<td>{vals}')
tab.append('</table>')
tab.append("<p>Stáhnout jako <a href='?format=csv'>CSV</a> nebo <a href='?format=tsv'>TSV</a>.")
if self.show_downlink:
tab.append("<p>Stáhnout jako <a href='?format=csv'>CSV</a> nebo <a href='?format=tsv'>TSV</a>.")
return Markup("\n".join(tab))
def to_csv(self, dialect: str) -> str:
Loading