1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-22 02:18:21 +02:00

Add teams

This commit is contained in:
Yohann D'ANELLO
2020-04-13 06:01:27 +02:00
parent 822853be66
commit 840376a4f5
15 changed files with 2054 additions and 16 deletions

View File

@ -107,18 +107,22 @@ class BusTeamTable(tables.Table):
color = tables.Column(
attrs={
"td": {
"style": lambda record: "background-color: #" + "".format(record.color) + ";"
"style": lambda record: "background-color: #{:06X}; color: #{:06X};"
.format(record.color, 0xFFFFFF - record.color, )
}
}
)
def render_color(self, value):
return "#{:06X}".format(value)
class Meta:
attrs = {
'class': 'table table-condensed table-striped table-hover'
}
model = BusTeam
template_name = 'django_tables2/bootstrap4.html'
fields = ('name', 'color', 'team',)
fields = ('name', 'color',)
row_attrs = {
'class': 'table-row',
'id': lambda record: "row-" + str(record.pk),