class Model2DirectByChartView(DirectByChartView): datamodel = MongoEngineInterface(Model2) chart_title = "Test Model1 Chart" definitions = [ {"group": "field_string", "series": ["field_integer", "field_float"]} ]
class ProjectTaskView(ModelView): datamodel = MongoEngineInterface(ProjectTask) list_columns = ['milestone','owner','startdate_actual','enddate_actual', 'value_delivered'] validators_columns = { 'startdate_proposed': [StartDateValidate('enddate_proposed','task')], 'startdate_actual': [StartDateValidate('enddate_actual','task')] }
class Model2DirectByChartView(DirectByChartView): datamodel = MongoEngineInterface(Model2) chart_title = 'Test Model1 Chart' definitions = [{ 'group': 'field_string', 'series': ['field_integer', 'field_float'] }]
class AppointmentBookingView(ModelView): datamodel = MongoEngineInterface(AppointmentBooking) list_columns = ['doctor','timestamp','procedure'] #base_filters = [["created_by", FilterEqualFunction, get_user]] add_form = AppointmentBookingForm validators_columns = { 'availability': [DoctorAvailabilityValidate('doctor','timestamp')] }
class ItineraryView(ModelView): datamodel = MongoEngineInterface(Itinerary) list_columns = [ 'point ', 'start ', 'end ', 'doc ', 'comm ', ]
class Model22View(ModelView): datamodel = MongoEngineInterface(Model2) list_columns = [ 'field_integer', 'field_float', 'field_string', 'field_method', 'group.field_string' ] add_exclude_columns = ['excluded_string'] edit_exclude_columns = ['excluded_string'] show_exclude_columns = ['excluded_string']
class ContactChartView(GroupByChartView): datamodel = MongoEngineInterface(Contact) chart_title = "Grouped contacts" label_columns = ContactModelView.label_columns chart_type = "PieChart" definitions = [ {"group": "contact_group", "series": [(aggregate_count, "contact_group")]}, {"group": "gender", "series": [(aggregate_count, "gender")]}, ]
class Model2GroupByChartView(GroupByChartView): datamodel = MongoEngineInterface(Model2) chart_title = 'Test Model1 Chart' definitions = [{ 'group': 'field_string', 'series': [(aggregate_sum, 'field_integer', aggregate_avg, 'field_integer', aggregate_count, 'field_integer')] }]
class Model22View(ModelView): datamodel = MongoEngineInterface(Model2) list_columns = [ "field_integer", "field_float", "field_string", "field_method", "group.field_string", ] add_exclude_columns = ["excluded_string"] edit_exclude_columns = ["excluded_string"] show_exclude_columns = ["excluded_string"]
class ContactChartView(GroupByChartView): datamodel = MongoEngineInterface(Contact) chart_title = 'Grouped contacts' label_columns = ContactModelView.label_columns chart_type = 'PieChart' definitions = [{ 'group': 'contact_group', 'series': [(aggregate_count, 'contact_group')] }, { 'group': 'gender', 'series': [(aggregate_count, 'gender')] }]
class TickChartView(GroupByChartView): datamodel = MongoEngineInterface(Tick) chart_title = 'Grouped ticks' label_columns = TickModelView.label_columns chart_type = 'PieChart' definitions = [{ 'group': 'analysis', 'series': [(aggregate_count, 'analysis.name')] }, { 'group': 'security', 'series': [(aggregate_count, 'security.object_id')] }]
class Model2View(ModelView): datamodel = MongoEngineInterface(Model2) list_columns = [ 'field_integer', 'field_float', 'field_string', 'field_method', 'group.field_string' ] edit_form_query_rel_fields = { 'group': [['field_string', FilterEqual, 'G2']] } add_form_query_rel_fields = { 'group': [['field_string', FilterEqual, 'G1']] } add_exclude_columns = ['excluded_string']
class WalletModelView(ModelView): datamodel = MongoEngineInterface(Wallet) list_columns = [ 'transaction_type', 'currency', 'value', 'bonus.name', 'user', 'bonus_cashed', 'timestamp' ] add_columns = [ 'transaction_type', 'currency', 'value', 'bonus', 'bonus_cashed', 'user' ] edit_columns = [ 'transaction_type', 'currency', 'value', 'bonus', 'bonus_cashed', 'user' ]
class Model2View(ModelView): datamodel = MongoEngineInterface(Model2) list_columns = [ "field_integer", "field_float", "field_string", "field_method", "group.field_string", ] edit_form_query_rel_fields = { "group": [["field_string", FilterEqual, "G2"]] } add_form_query_rel_fields = {"group": [["field_string", FilterEqual, "G1"]]} add_exclude_columns = ["excluded_string"]
class ContactTimeChartView(GroupByChartView): datamodel = MongoEngineInterface(Contact) chart_title = 'Grouped Birth contacts' chart_type = 'AreaChart' label_columns = ContactModelView.label_columns definitions = [{ 'group': 'month_year', 'formatter': pretty_month_year, 'series': [(aggregate_count, 'contact_group')] }, { 'group': 'year', 'formatter': pretty_year, 'series': [(aggregate_count, 'contact_group')] }]
class ContactModelView(ModelView): datamodel = MongoEngineInterface(Contact) label_columns = {"image_thumb_show": "Photo", "image_show": "Photo"} list_columns = [ "image_thumb_show", "name", "personal_celphone", "birthday", "contact_group", ] show_columns = [ "image_show", "name", "personal_celphone", "birthday", "contact_group", ] @expose("/mongo_download/<pk>") @has_access def mongo_download(self, pk): item = self.datamodel.get(pk) file = item.file.read() response = make_response(file) response.headers[ "Content-Disposition"] = "attachment; filename={0}".format( item.file.name) return response @expose("/img/<pk>") @has_access @permission_name("show_img") def img(self, pk): item = self.datamodel.get(pk) mime_type = item.image.content_type return Response(item.image.read(), mimetype=mime_type, direct_passthrough=True) @expose("/img_thumb/<pk>") @has_access @permission_name("show_img") def img_thumb(self, pk): item = self.datamodel.get(pk) mime_type = item.image.content_type return Response(item.image.thumbnail.read(), mimetype=mime_type, direct_passthrough=True)
class ExtraView(ModelView): datamodel = MongoEngineInterface(Extra) list_columns = [ 'user ', 'start ', 'end ', 'company ', 'price ', 'currency ', 'prepaid ', 'ResID ', 'link ', 'doc ', 'comm ', 'name ', ]
class Model2GroupByChartView(GroupByChartView): datamodel = MongoEngineInterface(Model2) chart_title = "Test Model1 Chart" definitions = [{ "group": "field_string", "series": [( aggregate_sum, "field_integer", aggregate_avg, "field_integer", aggregate_count, "field_integer", )], }]
class FilesView(ModelView): datamodel = MongoEngineInterface(Files) list_columns = [ 'filename', 'comm', 'download' ] @expose("/d/<pk>") def d(self, pk): item = self.datamodel.get(pk) file = item.file.read() mime = file[1:4].decode('utf-8').lower() response = make_response(file) response.headers["Content-Disposition"] = "attachment" response.headers["Content-Type"] = "{}".format(mime) return response
class HotelView(ModelView): datamodel = MongoEngineInterface(Hotel) list_columns = [ 'user ', 'start ', 'end ', 'company ', 'price ', 'currency ', 'prepaid ', 'ResID ', 'link ', 'doc ', 'comm ', 'name ', 'address ', 'GPS ', ]
class TravelsView(ModelView): datamodel = MongoEngineInterface(Travels) list_columns = [ 'where', 'start', 'end', 'travellers', 'outUK', 'business', 'bus', 'train', 'flight', 'cruise', 'cars', 'hotel', 'completed', 'comm' ]
class FlightsView(ModelView): datamodel = MongoEngineInterface(Flights) list_columns = [ 'user ', 'start ', 'end ', 'company ', 'price ', 'currency ', 'prepaid ', 'ResID ', 'link ', 'doc ', 'comm ', 'flight ', 'depart ', 'arrive ' ]
class ContactTimeChartView(GroupByChartView): datamodel = MongoEngineInterface(Contact) chart_title = "Grouped Birth contacts" chart_type = "AreaChart" label_columns = ContactModelView.label_columns definitions = [ { "group": "month_year", "formatter": pretty_month_year, "series": [(aggregate_count, "contact_group")], }, { "group": "year", "formatter": pretty_year, "series": [(aggregate_count, "contact_group")], }, ]
class TrainView(ModelView): datamodel = MongoEngineInterface(Train) list_columns = [ 'user ', 'start ', 'end ', 'company ', 'price ', 'currency ', 'prepaid ', 'ResID ', 'link ', 'doc ', 'comm ', 'route ', 'depart ', 'arrive ', ]
class EmployeeModelView(ModelView): datamodel = MongoEngineInterface(Employee) label_columns = {'team': 'Team'} list_columns = ['name', 'prefered_area', 'team'] show_fieldsets = [ ('Summary', { 'fields': ['name', 'user', 'team'] }), ('Assets', { 'fields': [ 'prefered_activity', 'prefered_language', 'prefered_area', 'years_experience' ], 'expanded': False }), ]
class BusView(ModelView): datamodel = MongoEngineInterface(Bus) list_columns = [ 'user', 'start', 'end', 'company', 'price', 'currency', 'prepaid', 'ResID', 'linked', 'doc', #'download', #'file_name', 'comm', 'route', 'depart', 'arrive' ]
class CruiseView(ModelView): datamodel = MongoEngineInterface(Cruise) list_columns = [ 'user', 'start', 'end', 'company', 'price', 'currency', 'prepaid', 'ResID', 'link', 'doc', 'comm', 'cruise', 'depart', 'arrive', 'itinerary', 'extra', 'agent' ]
class CarsView(ModelView): datamodel = MongoEngineInterface(Cars) list_columns = [ 'user ', 'start ', 'end ', 'company ', 'price ', 'currency ', 'prepaid ', 'ResID ', 'link ', 'doc ', 'comm ', #'insurance ', 'deposit ', #'scan ', 'depart ', 'arrive ', 'provider ' ]
class TopicsModelView(ModelView): route_base = '/topics' datamodel = MongoEngineInterface(Topics) label_columns = { 'topic': 'Topic', 'equation': 'Equation', 'instructions': 'Instructions', 'variables': 'Variables', 'problems': 'Problems' } # Data on summary page list_columns = ['topic', 'equation'] # Data on details page show_fieldsets = [('Topic Info', { 'fields': ['topic', 'equation', 'instructions'] }), ('Variable Info', { 'fields': ['variables'] }), ('Problems', { 'fields': ['problems'] })]
class AnalysisModelView(ModelView): datamodel = MongoEngineInterface(Analysis) related_views = [TickModelView] search_columns = ['name'] list_columns = ['name'] add_columns = ['name', 'input']