-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.py
124 lines (109 loc) · 2.8 KB
/
tables.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
from django.utils.translation import gettext_lazy as _
from rdmo.questions.models import Catalog
import django_tables2 as tables
from .columns import (
TitleColumn,
AvailableColumn,
LockedColumn,
SitesColumn,
OrderColumn,
)
class CatalogsTable(tables.Table):
title = TitleColumn(
verbose_name=_("Catalog"),
attrs={
"td": {
"class": "table-title",
"style": "max-width:400px; min-width:400px;",
}
},
)
updated = tables.DateTimeColumn(verbose_name=_("updated"), format="d.m.Y")
created = tables.DateTimeColumn(verbose_name=_("created"), format="d.m.Y")
available = AvailableColumn(
verbose_name=_("Available"),
attrs={
"td": {
"class": "panel-default text-center align-middle",
},
},
)
locked = LockedColumn(
verbose_name=_("Locked"),
attrs={
"td": {
"class": "panel-default text-center align-middle",
},
},
)
sites = SitesColumn(
verbose_name=_("Sites"),
attrs={
"td": {
"class": "panel-default",
"style": "max-width:120px; min-width:120px;",
},
},
)
projects_count = tables.Column(
verbose_name=_("Projects"),
attrs={
"td": {
"class": "panel-default text-center align-middle",
}
},
)
order = OrderColumn(
attrs={"td": {"class": "panel-default text-center align-middle"}}
)
class Meta:
model = Catalog
row_attrs = {
"class": " panel panel-default panel-sites",
"data-id": lambda record: record.pk,
}
attrs = {
"th": {
"class": "text-center align-middle",
}
}
per_page = 15
include = (
"title",
"updated",
"created",
"available",
"locked",
"sites",
"projects_count",
"order",
)
sequence = (
"title",
"available",
"locked",
"sites",
"updated",
"projects_count",
"order",
"created",
)
exclude = (
"id",
"key",
"uri",
"comment",
"title_lang1",
"title_lang2",
"title_lang3",
"title_lang4",
"title_lang5",
"help_lang1",
"help_lang2",
"help_lang3",
"help_lang4",
"help_lang5",
"uri_prefix",
"update",
)
empty_text = _("There are no catalogs available for this table")