class CountryStatsDirectChart(DirectChartView): datamodel = SQLAModel(CountryStats) chart_title = "Statistics" chart_type = "LineChart" direct_columns = { "General Stats": ("stat_date", "population", "unemployed", "college") } base_order = ("stat_date", "asc")
class CountryDirectChartView(DirectByChartView): datamodel = SQLAModel(CountryStats) chart_title = "Direct Data" definitions = [ { "group": "stat_date", "series": ["unemployed", "college"], } ]
class ContactGeneralView(GeneralView): datamodel = SQLAModel(Contact) label_columns = {"group": "Contacts Group"} list_columns = ["name", "personal_celphone", "birthday", "group"] base_order = ("name", "asc") show_fieldsets = [ ("Summary", {"fields": ["name", "gender", "group"]}), ( "Personal Info", { "fields": [ "address", "birthday", "personal_phone", "personal_celphone", ], "expanded": False, }, ), ] add_fieldsets = [ ("Summary", {"fields": ["name", "gender", "group"]}), ( "Personal Info", { "fields": [ "address", "birthday", "personal_phone", "personal_celphone", ], "expanded": False, }, ), ] edit_fieldsets = [ ("Summary", {"fields": ["name", "gender", "group"]}), ( "Personal Info", { "fields": [ "address", "birthday", "personal_phone", "personal_celphone", ], "expanded": False, }, ), ]
class ViewMenuModelView(ModelView): route_base = '/viewmenus' datamodel = SQLAModel(ViewMenu) list_title = lazy_gettext('List View Menus') show_title = lazy_gettext('Show View Menu') add_title = lazy_gettext('Add View Menu') edit_title = lazy_gettext('Edit View Menu') label_columns = {'name': lazy_gettext('Name')}
class PermissionModelView(ModelView): route_base = '/permissions' datamodel = SQLAModel(Permission) list_title = lazy_gettext('List Base Permissions') show_title = lazy_gettext('Show Base Permission') add_title = lazy_gettext('Add Base Permission') edit_title = lazy_gettext('Edit Base Permission') label_columns = {'name': lazy_gettext('Name')}
class CountryDirectChartView(DirectByChartView): datamodel = SQLAModel(CountryStats) chart_title = 'Direct Data' definitions = [ { #'label': 'Monthly', 'group': 'stat_date', 'series': ['unemployed', 'college'] } ]
class PermissionViewModelView(ModelView): route_base = '/permissionviews' datamodel = SQLAModel(PermissionView) list_title = lazy_gettext('List Permissions on Views/Menus') show_title = lazy_gettext('Show Permission on Views/Menus') add_title = lazy_gettext('Add Permission on Views/Menus') edit_title = lazy_gettext('Edit Permission on Views/Menus') label_columns = {'permission': lazy_gettext('Permission'), 'view_menu': lazy_gettext('View/Menu')} list_columns = ['permission', 'view_menu'] show_columns = ['permission', 'view_menu'] search_columns = ['permission', 'view_menu']
class ChallGroupByChartView(GroupByChartView): datamodel = SQLAModel(Chall) chart_title = 'Ctfs Data' definitions = [ { 'group': 'category', 'series': [(aggregate_sum, 'points')] }, { 'group': 'solved_by', 'series': [(aggregate_sum, 'points')] }, ]
class RoleModelView(ModelView): route_base = '/roles' datamodel = SQLAModel(Role) list_title = lazy_gettext('List Roles') show_title = lazy_gettext('Show Role') add_title = lazy_gettext('Add Role') edit_title = lazy_gettext('Edit Role') label_columns = {'name': lazy_gettext('Name'), 'permissions': lazy_gettext('Permissions')} list_columns = ['name', 'permissions'] show_columns = ['name', 'permissions'] order_columns = ['name'] search_columns = ['name']
class CountryGroupByChartView(GroupByChartView): datamodel = SQLAModel(CountryStats) chart_title = "Statistics" definitions = [ { "label": "Country Stat", "group": "country", "series": [ (aggregate_avg, "unemployed"), (aggregate_avg, "population"), (aggregate_avg, "college"), ], }, { "group": "month_year", "formatter": pretty_month_year, "series": [ (aggregate_sum, "unemployed"), (aggregate_avg, "population"), (aggregate_avg, "college"), ], }, ] """ [{ 'label': 'String', 'group': '<COLNAME>'|'<FUNCNAME>' 'formatter: <FUNC> 'series': [(<AGGR FUNC>, <COLNAME>|'<FUNCNAME>'),...] } ] """ group_by_columns = ["country", "political_type", "country_political", "month_year"] aggregate_by_column = [ (aggregate_avg, "unemployed"), (aggregate_avg, "population"), (aggregate_avg, "college"), ] # [{'aggr_func':<FUNC>,'column':'<COL NAME>'}] formatter_by_columns = {"month_year": pretty_month_year}
class ContactGeneralView(GeneralView): datamodel = SQLAModel(Contact) label_columns = {'group': 'Contacts Group'} list_columns = ['name', 'personal_celphone', 'birthday', 'group'] base_order = ('name', 'asc') show_fieldsets = [ ('Summary', { 'fields': ['name', 'gender', 'group'] }), ('Personal Info', { 'fields': ['address', 'birthday', 'personal_phone', 'personal_celphone'], 'expanded': False }), ] add_fieldsets = [ ('Summary', { 'fields': ['name', 'gender', 'group'] }), ('Personal Info', { 'fields': ['address', 'birthday', 'personal_phone', 'personal_celphone'], 'expanded': False }), ] edit_fieldsets = [ ('Summary', { 'fields': ['name', 'gender', 'group'] }), ('Personal Info', { 'fields': ['address', 'birthday', 'personal_phone', 'personal_celphone'], 'expanded': False }), ]
class UserStatsChartView(DirectByChartView): datamodel = SQLAModel(User) chart_title = lazy_gettext('User Statistics') label_columns = { 'username': lazy_gettext('User Name'), 'login_count': lazy_gettext('Login count'), 'fail_login_count': lazy_gettext('Failed login count') } search_columns = UserModelView.search_columns definitions = [{ 'label': 'Login Count', 'group': 'username', 'series': ['login_count'] }, { 'label': 'Failed Login Count', 'group': 'username', 'series': ['fail_login_count'] }]
class CountryGroupByChartView(GroupByChartView): datamodel = SQLAModel(CountryStats) chart_title = 'Statistics' definitions = [ { 'label': 'Country Stat', 'group': 'country', 'series': [(aggregate_avg, 'unemployed'), (aggregate_avg, 'population'), (aggregate_avg, 'college') ] }, { #'label': 'Monthly', 'group': 'month_year', 'formatter': pretty_month_year, 'series': [(aggregate_avg, 'unemployed'), (aggregate_avg, 'population'), (aggregate_avg, 'college') ] } ] """ [{ 'label': 'String', 'group': '<COLNAME>'|'<FUNCNAME>' 'formatter: <FUNC> 'series': [(<AGGR FUNC>, <COLNAME>|'<FUNCNAME>'),...] } ] """ #label_columns = {'month_year': 'Month Year', 'country_political': 'Country Political'} group_by_columns = ['country', 'political_type', 'country_political', 'month_year'] # ['<COL NAME>'] aggregate_by_column = [(aggregate_avg, 'unemployed'), (aggregate_avg, 'population'), (aggregate_avg, 'college')] # [{'aggr_func':<FUNC>,'column':'<COL NAME>'}] formatter_by_columns = {'month_year': pretty_month_year}
class ContactChartView(ChartView): chart_title = "Grouped contacts" label_columns = ContactGeneralView.label_columns group_by_columns = ["group", "gender"] datamodel = SQLAModel(Contact)
class ContactTimeChartView(TimeChartView): chart_title = 'Grouped Birth contacts' chart_type = 'AreaChart' label_columns = ContactGeneralView.label_columns group_by_columns = ['birthday'] datamodel = SQLAModel(Contact)
class ContactChartView(ChartView): chart_title = 'Grouped contacts' label_columns = ContactGeneralView.label_columns group_by_columns = ['group', 'gender'] datamodel = SQLAModel(Contact)
class PoliticalTypeModelView(ModelView): datamodel = SQLAModel(PoliticalType)
class UserModelView(ModelView): route_base = '/users' datamodel = SQLAModel(User) list_title = lazy_gettext('List Users') show_title = lazy_gettext('Show User') add_title = lazy_gettext('Add User') edit_title = lazy_gettext('Edit User') label_columns = {'get_full_name': lazy_gettext('Full Name'), 'first_name': lazy_gettext('First Name'), 'last_name': lazy_gettext('Last Name'), 'username': lazy_gettext('User Name'), 'password': lazy_gettext('Password'), 'active': lazy_gettext('Is Active?'), 'email': lazy_gettext('EMail'), 'role': lazy_gettext('Role'), 'last_login': lazy_gettext('Last login'), 'login_count': lazy_gettext('Login count'), 'fail_login_count': lazy_gettext('Failed login count'), 'created_on': lazy_gettext('Created on'), 'created_by': lazy_gettext('Created by'), 'changed_on': lazy_gettext('Changed on'), 'changed_by': lazy_gettext('Changed by')} description_columns = {'first_name': lazy_gettext('Write the user first name or names'), 'last_name': lazy_gettext('Write the user last name'), 'username': lazy_gettext( 'Username valid for authentication on DB or LDAP, unused for OID auth'), 'password': lazy_gettext( 'Please use a good password policy, this application does not check this for you'), 'active': lazy_gettext('Its not a good policy to remove a user, just make it inactive'), 'email': lazy_gettext('The users email, this will also be used for OID auth'), 'role': lazy_gettext( 'The user role on the application, this will associate with a list of permissions'), 'conf_password': lazy_gettext('Please rewrite the users password to confirm')} list_columns = ['first_name', 'last_name', 'username', 'email', 'active', 'role'] show_fieldsets = [ (lazy_gettext('User info'), {'fields': ['username', 'active', 'role', 'login_count']}), (lazy_gettext('Personal Info'), {'fields': ['first_name', 'last_name', 'email'], 'expanded': True}), (lazy_gettext('Audit Info'), {'fields': ['last_login', 'fail_login_count', 'created_on', 'created_by', 'changed_on', 'changed_by'], 'expanded': False}), ] user_show_fieldsets = [ (lazy_gettext('User info'), {'fields': ['username', 'active', 'role', 'login_count']}), (lazy_gettext('Personal Info'), {'fields': ['first_name', 'last_name', 'email'], 'expanded': True}), ] order_columns = ['first_name', 'last_name', 'username', 'email'] search_columns = ['first_name', 'last_name', 'username', 'email', 'role', 'created_by', 'changed_by', 'changed_on','changed_by', 'login_count'] add_columns = ['first_name', 'last_name', 'username', 'active', 'email', 'role'] edit_columns = ['first_name', 'last_name', 'username', 'active', 'email', 'role'] user_info_title = lazy_gettext("Your user information")
class CountryStatsModelView(ModelView): datamodel = SQLAModel(CountryStats) list_columns = ["country", "stat_date", "population", "unemployed", "college"]
class CountryModelView(ModelView): datamodel = SQLAModel(Country)
class CountryStatsModelView(ModelView): datamodel = SQLAModel(CountryStats) list_columns = ['country', 'stat_date', 'population', 'unemployed', 'college']
class CountryStatsDirectChart(DirectChartView): datamodel = SQLAModel(CountryStats) chart_title = 'Statistics' chart_type = 'LineChart' direct_columns = {'General Stats': ('stat_date', 'population', 'unemployed', 'college')} base_order = ('stat_date', 'asc')
class ChallModelView(ModelView): datamodel = SQLAModel(Chall)
class CtfModelView(ModelView): datamodel = SQLAModel(Ctf)
class ContactTimeChartView(TimeChartView): chart_title = "Grouped Birth contacts" chart_type = "AreaChart" label_columns = ContactGeneralView.label_columns group_by_columns = ["birthday"] datamodel = SQLAModel(Contact)
class GroupGeneralView(GeneralView): datamodel = SQLAModel(Group) related_views = [ContactGeneralView]
class PlayerModelView(ModelView): datamodel = SQLAModel(Player)