2019-07-10 12:36:31 +00:00
|
|
|
from flask_table import Table, Col
|
|
|
|
|
|
|
|
|
|
|
|
class AdminUserTable(Table):
|
|
|
|
"""
|
|
|
|
Declares the table describing colum by column.
|
|
|
|
"""
|
|
|
|
classes = ['highlight', 'responsive-table']
|
2019-08-08 14:06:41 +00:00
|
|
|
username = Col('Username', column_html_attrs={'class': 'username'})
|
|
|
|
email = Col('Email', column_html_attrs={'class': 'email'})
|
|
|
|
role_id = Col('Role', column_html_attrs={'class': 'role'})
|
|
|
|
confirmed = Col('Confrimed Status', column_html_attrs={'class': 'confirmed'})
|
2019-07-10 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AdminUserItem(object):
|
|
|
|
"""
|
|
|
|
Describes one item like one row per table.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, username, email, role_id, confirmed):
|
|
|
|
self.username = username
|
|
|
|
self.email = email
|
|
|
|
self.role_id = role_id
|
|
|
|
self.confirmed = confirmed
|
|
|
|
|
|
|
|
if self.role_id == 1:
|
|
|
|
self.role_id = 'User'
|
|
|
|
elif self.role_id == 2:
|
|
|
|
self.role_id = 'Admin'
|