<s> import sqlalchemy as sa <EOL> from flask . ext . appbuilder . models . sqla . interface import SQLAInterface <EOL> from flask . ext . appbuilder import ModelView <EOL> from flask . ext . appbuilder . fieldwidgets import BS3TextFieldWidget <EOL> from flask . ext . babelpkg import gettext <EOL> from flask . ext . appbuilder . models . sqla . filters import BaseFilter <EOL> from flask . ext . babelpkg import lazy_gettext <EOL> from app import appbuilder , db <EOL> from wtforms . fields import TextField <EOL> from . models import Device , Site , DeviceType , LowerCaseString <EOL> class MySQLAInterface ( SQLAInterface ) : <EOL> def is_string ( self , col_name ) : <EOL> try : <EOL> return ( isinstance ( self . list_columns [ col_name ] . type , sa . types . String ) or <EOL> isinstance ( self . list_columns [ col_name ] . type , LowerCaseString ) ) <EOL> except : <EOL> return False <EOL> class SiteModelView ( ModelView ) : <EOL> datamodel = SQLAInterface ( Site ) <EOL> class DeviceTypeModelView ( ModelView ) : <EOL> datamodel = SQLAInterface ( DeviceType ) <EOL> class DeviceModelView ( ModelView ) : <EOL> datamodel = MySQLAInterface ( Device ) <EOL> db . create_all ( ) <EOL> appbuilder . add_view ( SiteModelView , "<STR_LIT>" , icon = "<STR_LIT>" , category = "<STR_LIT>" , category_icon = '<STR_LIT>' ) <EOL> appbuilder . add_view ( DeviceTypeModelView , "<STR_LIT>" , icon = "<STR_LIT>" , category = "<STR_LIT>" , category_icon = '<STR_LIT>' ) <EOL> appbuilder . add_view ( DeviceModelView , "<STR_LIT>" , icon = "<STR_LIT>" , category = "<STR_LIT>" , category_icon = '<STR_LIT>' ) </s>
