<commit_before>from models import Person, Group
from flask.ext.appbuilder.baseapp import BaseApp
from flask.ext.appbuilder.views import GeneralView, BaseView
from flask.ext.appbuilder.charts.views import ChartView
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask.ext.appbuilder.widgets import ListThumbnail
from flask.ext.appbuilder.menu import Menu
from flask.ext.appbuilder.filters import *


class PersonGeneralView(GeneralView):
    route_base = '/persons'
    datamodel = SQLAModel(Person)

    list_title = 'List Contacts'
    show_title = 'Show Contact'
    add_title = 'Add Contact'
    edit_title = 'Edit Contact'
    
    list_widget = ListThumbnail

    label_columns = {'name':'Name','photo':'Photo','photo_img':'Photo','address':'Address','birthday':'Birthday','personal_phone':'Personal Phone',
                'personal_celphone':'Personal Celphone','personal_email':'Personal Email',
                'business_function':'Business Function',
        'business_phone':'Business Phone','business_celphone':'Business Celphone',
                'business_email':'Business Email','notes':'Notes','group':'Group', 'group_id':'Group'}
    list_columns = ['photo_img', 'name','personal_celphone','business_celphone','birthday','group']

    order_columns = ['name','personal_celphone','business_celphone','birthday']
    search_columns = ['name','personal_celphone','group']

    show_fieldsets = [
                 ('Summary',{'fields':['photo_img','name','address','group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]

    add_fieldsets = [
                 ('Summary',{'fields':['name','photo','address','group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]

    edit_fieldsets = [
                 ('Summary',{'fields':['name','photo','address', 'group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]


class GroupGeneralView(GeneralView):
    route_base = '/groups'
    datamodel = SQLAModel(Group)
    related_views = [PersonGeneralView()]

    list_title = 'List Groups'
    show_title = 'Show Group'
    add_title = 'Add Group'
    edit_title = 'Edit Group'

    label_columns = { 'name':'Name','address':'Address','phone1':'Phone (1)','phone2':'Phone (2)','taxid':'Tax ID','notes':'Notes'}
    list_columns = ['name','notes']
    show_columns = ['name','address','phone1','phone2','taxid','notes']
    order_columns = ['name','notes']
    search_columns = ['name']

class PersonChartView(ChartView):
    
    route_base = '/persons'
    chart_title = 'Grouped Persons'
    label_columns = PersonGeneralView.label_columns
    group_by_columns = ['group']
    datamodel = SQLAModel(Person)
<commit_msg>Update views.py<commit_after>from models import Person, Group
from flask.ext.appbuilder.baseapp import BaseApp
from flask.ext.appbuilder.views import GeneralView, BaseView
from flask.ext.appbuilder.charts.views import ChartView
from flask.ext.appbuilder.models.datamodel import SQLAModel
from flask.ext.appbuilder.widgets import ListThumbnail
from flask.ext.appbuilder.menu import Menu
from flask.ext.appbuilder.filters import *


class PersonGeneralView(GeneralView):
    route_base = '/persons'
    datamodel = SQLAModel(Person, db.session)

    list_title = 'List Contacts'
    show_title = 'Show Contact'
    add_title = 'Add Contact'
    edit_title = 'Edit Contact'
    
    list_widget = ListThumbnail

    label_columns = {'name':'Name','photo':'Photo','photo_img':'Photo','address':'Address','birthday':'Birthday','personal_phone':'Personal Phone',
                'personal_celphone':'Personal Celphone','personal_email':'Personal Email',
                'business_function':'Business Function',
        'business_phone':'Business Phone','business_celphone':'Business Celphone',
                'business_email':'Business Email','notes':'Notes','group':'Group', 'group_id':'Group'}
    list_columns = ['photo_img', 'name','personal_celphone','business_celphone','birthday','group']

    order_columns = ['name','personal_celphone','business_celphone','birthday']
    search_columns = ['name','personal_celphone','group']

    show_fieldsets = [
                 ('Summary',{'fields':['photo_img','name','address','group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]

    add_fieldsets = [
                 ('Summary',{'fields':['name','photo','address','group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]

    edit_fieldsets = [
                 ('Summary',{'fields':['name','photo','address', 'group']}),
                 ('Personal Info',{'fields':['birthday','personal_phone','personal_celphone','personal_email'],'expanded':False}),
                 ('Professional Info',{'fields':['business_function','business_phone','business_celphone','business_email'],'expanded':False}),
                 ('Extra',{'fields':['notes'],'expanded':False}),
                 ]


class GroupGeneralView(GeneralView):
    route_base = '/groups'
    datamodel = SQLAModel(Group, db.session)
    related_views = [PersonGeneralView()]

    list_title = 'List Groups'
    show_title = 'Show Group'
    add_title = 'Add Group'
    edit_title = 'Edit Group'

    label_columns = { 'name':'Name','address':'Address','phone1':'Phone (1)','phone2':'Phone (2)','taxid':'Tax ID','notes':'Notes'}
    list_columns = ['name','notes']
    show_columns = ['name','address','phone1','phone2','taxid','notes']
    order_columns = ['name','notes']
    search_columns = ['name']

class PersonChartView(ChartView):
    
    route_base = '/persons'
    chart_title = 'Grouped Persons'
    label_columns = PersonGeneralView.label_columns
    group_by_columns = ['group']
    datamodel = SQLAModel(Person)

{'fraction_non_alphanumeric': 0.17406380027739252, 'fraction_numerical': 0.001664355062413315, 'mean_word_length': 4.385362210604929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5695747', 'n_tokens_mistral': 2090, 'n_tokens_neox': 1941, 'n_words': 287}