mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
from flask_table import Table, Col, LinkCol
|
|
|
|
|
|
class AdminUserTable(Table):
|
|
"""
|
|
Declares the table describing colum by column.
|
|
"""
|
|
classes = ['highlight', 'responsive-table']
|
|
username = Col('Username', column_html_attrs={'class': 'username'},
|
|
th_html_attrs={'class': 'sort',
|
|
'data-sort': 'username'})
|
|
email = Col('Email', column_html_attrs={'class': 'email'},
|
|
th_html_attrs={'class': 'sort',
|
|
'data-sort': 'email'})
|
|
role_id = Col('Role', column_html_attrs={'class': 'role'},
|
|
th_html_attrs={'class': 'sort',
|
|
'data-sort': 'role'})
|
|
confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'},
|
|
th_html_attrs={'class': 'sort',
|
|
'data-sort': 'confirmed'})
|
|
id = Col('User Id', column_html_attrs={'class': 'id'},
|
|
th_html_attrs={'class': 'sort',
|
|
'data-sort': 'id'})
|
|
url = LinkCol('Profile', 'admin.admin_user_page',
|
|
url_kwargs=dict(user_id='id'),
|
|
anchor_attrs={'class': 'waves-effect waves-light btn-small'})
|
|
|
|
|
|
class AdminUserItem(object):
|
|
"""
|
|
Describes one item like one row per table.
|
|
"""
|
|
|
|
def __init__(self, username, email, role_id, confirmed, id):
|
|
self.username = username
|
|
self.email = email
|
|
self.role_id = role_id
|
|
self.confirmed = confirmed
|
|
self.id = id
|
|
|
|
if self.role_id == 1:
|
|
self.role_id = 'User'
|
|
elif self.role_id == 2:
|
|
self.role_id = 'Admin'
|