Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
24a65da5
Commit
24a65da5
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Table: Možnost definovat class vytvářené tabulky
parent
94dd29ac
Branches
Branches containing commit
No related tags found
1 merge request
!17
Výsledkovka pomocí mo.web.table
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/table.py
+8
-3
8 additions, 3 deletions
mo/web/table.py
with
8 additions
and
3 deletions
mo/web/table.py
+
8
−
3
View file @
24a65da5
...
@@ -7,7 +7,6 @@ from markupsafe import Markup
...
@@ -7,7 +7,6 @@ from markupsafe import Markup
from
typing
import
Any
,
Dict
,
Sequence
,
Optional
,
Iterable
,
Union
from
typing
import
Any
,
Dict
,
Sequence
,
Optional
,
Iterable
,
Union
import
urllib.parse
import
urllib.parse
import
werkzeug.exceptions
import
werkzeug.exceptions
from
werkzeug.utils
import
html
from
mo.csv
import
FileFormat
from
mo.csv
import
FileFormat
import
mo.db
as
db
import
mo.db
as
db
...
@@ -92,15 +91,21 @@ class Table:
...
@@ -92,15 +91,21 @@ class Table:
rows
:
Iterable
[
Row
]
rows
:
Iterable
[
Row
]
filename
:
str
filename
:
str
show_downlink
:
bool
show_downlink
:
bool
table_class
:
str
def
__init__
(
self
,
columns
:
Sequence
[
Column
],
rows
:
Iterable
[
Row
],
filename
:
str
,
show_downlink
:
bool
=
True
):
def
__init__
(
self
,
columns
:
Sequence
[
Column
],
rows
:
Iterable
[
Row
],
filename
:
str
,
show_downlink
:
bool
=
True
,
table_class
:
str
=
"
data
"
):
self
.
columns
=
columns
self
.
columns
=
columns
self
.
rows
=
rows
self
.
rows
=
rows
self
.
filename
=
filename
self
.
filename
=
filename
self
.
show_downlink
=
show_downlink
self
.
show_downlink
=
show_downlink
self
.
table_class
=
table_class
def
to_html
(
self
)
->
str
:
def
to_html
(
self
)
->
str
:
tab
=
[
'
<table class=
data
>
'
,
'
<thead>
'
,
'
<tr>
'
]
tab
=
[
f
'
<table class=
"
{
self
.
table_class
}
"
>
'
,
'
<thead>
'
,
'
<tr>
'
]
for
c
in
self
.
columns
:
for
c
in
self
.
columns
:
tab
.
append
(
f
'
\t
<th>
{
c
.
title
}
'
)
tab
.
append
(
f
'
\t
<th>
{
c
.
title
}
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment