class Permission(grid_cls): webgrid.Column(_('Name'), permission_cls.token, filters.TextFilter) webgrid.Column(_('Description'), permission_cls.description, filters.TextFilter) def query_prep(self, query, has_sort, has_filters): if not has_sort: query = query.order_by(permission_cls.token) return query
class User(grid_cls): action_column_cls( '', user_cls.id, edit_endpoint=edit_endpoint, delete_endpoint=delete_endpoint, edit_permission_for=lambda _: edit_permission, delete_permission_for=lambda _: delete_permission ) webgrid.Column(_('User ID'), user_cls.username, filters.TextFilter) if flask.current_app.auth_manager.mail_manager and hasattr(user_cls, 'is_verified'): webgrid.YesNoColumn(_('Verified'), user_cls.is_verified, filters.YesNoFilter) webgrid.YesNoColumn(_('Superuser'), user_cls.is_superuser, filters.YesNoFilter) if ( flask.current_app.auth_manager.mail_manager and hasattr(user_cls, 'is_verified') and resend_verification_endpoint is not None and flask.current_app.config['KEGAUTH_EMAIL_OPS_ENABLED'] ): ResendVerificationColumn(_('Resend Verification'), resend_verification_endpoint) def query_prep(self, query, has_sort, has_filters): if not has_sort: query = query.order_by(user_cls.username) return query
class Bundle(grid_cls): action_column_cls('', bundle_cls.id, edit_endpoint=edit_endpoint, delete_endpoint=delete_endpoint, edit_permission_for=lambda _: edit_permission, delete_permission_for=lambda _: delete_permission) webgrid.Column(_('Name'), bundle_cls.name, filters.TextFilter) def query_prep(self, query, has_sort, has_filters): if not has_sort: query = query.order_by(bundle_cls.name) return query
class SampleGrid(Grid): webgrid.Column('Email', User.email)