Esempio n. 1
1

def pretty_year(value):
    return str(value.year)


class ContactTimeChartView(GroupByChartView):
    datamodel = SQLAModel(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")]},
    ]


db.create_all()
fill_gender()
appbuilder.add_view(
    GroupModelView, "List Groups", icon="fa-folder-open-o", category="Contacts", category_icon="fa-envelope"
)
appbuilder.add_view(ContactModelView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView, "Contacts Chart", icon="fa-dashboard", category="Contacts")
appbuilder.add_view(ContactTimeChartView, "Contacts Birth Chart", icon="fa-dashboard", category="Contacts")

log.info("F.A.B. Version: {0}".format(appbuilder.version))
log.info("User extension class {0}".format(UserExtensionMixin.__subclasses__()[0]))
Esempio n. 2
1
    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_sum, 'unemployed'),
                       (aggregate_avg, 'population'),
                       (aggregate_avg, 'college')
            ]
        }
    ]


appbuilder.add_view(CountryModelView, "List Countries", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_view(PoliticalTypeModelView, "List Political Types", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_view(CountryStatsModelView, "List Country Stats", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_separator("Statistics")
appbuilder.add_view(CountryStatsDirectChart, "Show Country Chart", icon="fa-dashboard", category="Statistics")
appbuilder.add_view(CountryGroupByChartView, "Group Country Chart", icon="fa-dashboard", category="Statistics")
appbuilder.add_view(CountryDirectChartView, "Show Country Chart", icon="fa-dashboard", category="Statistics")

Esempio n. 3
0
                            valid_to=datetime.datetime.utcfromtimestamp(int(endpoint['details']['cert']['notAfter']) / 1000).replace(tzinfo=datetime.timezone.utc), \
                            key_value=str(endpoint['details']['key']['alg'] + str(endpoint['details']['key']['size'])), sha1_fingerprint=str(endpoint['details']['cert']['sha1Hash']) \
                                ))
                        db.session.commit()
                    flash("Scan finished for: " + str(item.dns_name), 'success')
                else:
                    for endpoint in data['endpoints']:
                        db.session.query(Certificates).filter_by(dns_name=host).delete()
                        db.session.add(Certificates(dns_name=host, endpoint_ip=str(endpoint['ipAddress']), subject="Scan failure. Validate certificate manually.", grade="X"))
                        db.session.commit()
        return redirect('/certificatemodelview/list/') 




@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html', base_template=appbuilder.base_template, appbuilder=appbuilder), 404

db.create_all()


### Register Views ###
appbuilder.add_view_no_menu(HomeView)
appbuilder.add_view(CertificateModelView, "Certificates", icon="fa-search", category="Certificates", category_icon="fa-search")


appbuilder.security_cleanup() #cleanup any dangling permissions


Esempio n. 4
0
    @expose('/tweet/')
    @has_access
    def tweet(self):
        resp = self.appbuilder.sm.oauth_remotes['twitter'].post('statuses/update.json', data={
        'status':   'The text we want to tweet'
        })
        if resp.status == 403:
            flash('Your tweet was too long. {0}'.format(resp.raw_data))
        else:
            flash('Successfully tweeted your tweet (ID: #%s)' % resp.data['id'])
        return redirect(self.appbuilder.get_url_for_index)

        
fill_gender()

appbuilder.add_view(GroupModelView, "List Groups", icon="fa-folder-open-o", category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(ContactModelView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactModelView2, "List Contacts 2", icon="fa-envelope", category="Contacts")
appbuilder.add_view(FloatModelView, "List Float Model", icon="fa-envelope", category="Contacts")
appbuilder.add_view(MultipleViewsExp, "Multiple Views", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView, "Contacts Chart", icon="fa-dashboard", category="Contacts")
appbuilder.add_view(ContactTimeChartView, "Contacts Birth Chart", icon="fa-dashboard", category="Contacts")

appbuilder.add_view(ProductManufacturerView, "List Manufacturer", icon="fa-folder-open-o", category="Products",
                    category_icon='fa-envelope')
appbuilder.add_view(ProductModelView, "List Models", icon="fa-envelope", category="Products")
appbuilder.add_view(ProductView, "List Products", icon="fa-envelope", category="Products")
appbuilder.add_link("ContacModelView_lnk","ContactModelView.add", icon="fa-envelope", label="Add Contact")
appbuilder.add_view(TestForm, "My form View", icon="fa-group", label='My Test form')
appbuilder.add_view(PostTweet, "Tweet", icon="fa-twitter", label='Tweet')
Esempio n. 5
0
class TagViewES(ModelView):
        datamodel = SQLAInterface(Tag)
        related_views = [SummaryViewES]
        list_columns = ['subject_es']  

class ArticleMasterViewEN(MasterDetailView):
        datamodel = SQLAInterface(Tag)
        related_views = [TagViewEN, SummaryViewEN]
        list_columns = ['subject_en'] 

class ArticleMasterViewES(MasterDetailView):
        datamodel = SQLAInterface(Tag)
        related_views = [TagViewES, SummaryViewES]
        list_columns = ['subject_es'] 


db.create_all()

appbuilder.add_view(ArticleMasterViewEN, "By subject", icon = "fa-tags", category = "View stories",
                category_icon = "fa-book")
appbuilder.add_separator("View stories")
appbuilder.add_view(SummaryViewEN, "Detailed search", icon = "fa-search-plus", category = "View stories",
                category_icon = "fa-book")

appbuilder.add_view(ArticleMasterViewES, "Por tema", icon = "fa-tags", category = "Ver historias",
        category_icon = "fa-book")
appbuilder.add_separator("Ver historias")
appbuilder.add_view(SummaryViewES, "Buscar en detalle", icon = "fa-search-plus", category = "Ver historias",
        category_icon = "fa-book")
Esempio n. 6
0
def get_oauth_user_info(sm, provider, response=None):
# for GITHUB
    if provider == 'github' or provider == 'githublocal':
        me = sm.oauth_remotes[provider].get('user')
        return {'username': "******" + me.data.get('login')}
    # for twitter
    if provider == 'twitter':
        me = sm.oauth_remotes[provider].get('account/settings.json')
        return {'username': "******" + me.data.get('screen_name', '')}
    # for linkedin
    if provider == 'linkedin':
        me = sm.oauth_remotes[provider].get('people/~:(id,email-address,first-name,last-name)?format=json')
        return {'username': "******" + me.data.get('id', ''),
                'email': me.data.get('email-address', ''),
                'first_name': me.data.get('firstName', ''),
                'last_name': me.data.get('lastName', '')}
    # for Google
    if provider == 'google':
        me = sm.oauth_remotes[provider].get('userinfo')
        return {'username': me.data.get('id', ''),
                'first_name': me.data.get('given_name', ''),
                'last_name': me.data.get('family_name', ''),
                'email': me.data.get('email', '')}
"""


appbuilder.add_view(SendTweet, "Tweet", icon="fa-twitter", label="Tweet")


db.create_all()
Esempio n. 7
0
    @has_access
    def method1(self):
            # do something with param1
            # and return to previous page or index
        return 'Hello'

    @expose('/method2/<string:param1>')
    @has_access
    def method2(self, param1):
        # do something with param1
        # and render template with param
        param1 = 'Goodbye %s' % (param1)
        return param1

    @expose('/method3/<string:param1>')
    @has_access
    def method3(self, param1):
        # do something with param1
        # and render template with param
        param1 = 'Goodbye %s' % (param1)
        return self.render_template('method3.html',
                               param1=param1)


appbuilder.add_view(MyView(), "Method1", category='My View')
#appbuilder.add_view(MyView(), "Method2", href='/myview/method2/jonh', category='My View')
# Use add link instead there is no need to create MyView twice.
appbuilder.add_link("Method2", href='/myview/method2/jonh', category='My View')
appbuilder.add_link("Method3", href='/myview/method3/jonh', category='My View')

Esempio n. 8
0
    related_views = [AnimalModelView]


class VetMasterView(MasterDetailView):
    datamodel = SQLAModel(Vet)
    related_views = [AnimalModelView]


class StatusMasterView(MasterDetailView):
    datamodel = SQLAModel(AnimalStatus)
    related_views = [AnimalHistoryModelView]


db.create_all()
fill_data()
appbuilder.add_view(VetModelView, "Vets", icon="fa-building-o", category='Vet')
appbuilder.add_view(VetMasterView, "Vet Listing", icon="fa-paw", category='Vet')

appbuilder.add_view(PersonModelView, "People", icon="fa-users", category='Customers')
appbuilder.add_view(PaymentModelView, "Payments", icon="fa-money", category='Customers')

appbuilder.add_view(AnimalModelView, "Animal", icon="fa-paw", category='Animals')
appbuilder.add_view(AnimalHistoryModelView, "Animal History", icon="fa-paw", category='Animals')
appbuilder.add_view(AnimalStatusModelView, "Edit Status", icon="fa-paw", category='Animals')
appbuilder.add_view(ColorModelView, "Edit Colors", icon="fa-paw", category='Animals')
appbuilder.add_view(StatusMasterView, "List Status", icon="fa-paw", category='Animals')

appbuilder.add_view(BreedModelView, "Breed", icon="fa-paw", category='Breeds')
appbuilder.add_view(AnimalTypeModelView, "Animal Type", icon="fa-paw", category='Breeds')
appbuilder.add_view(BreedMasterView, "List Breeds", icon="fa-paw", category='Breeds')
Esempio n. 9
0
            'series': ['dli']
        },
        {
            'label': 'Ea',
            'group': 'timestamp',
            'series': ['ea']
        },
    ]


db.create_all()
db.event.listen(GrowSession.day_start_hour, 'set', on_grow_session_hour_changed, retval=True)
db.event.listen(GrowSession.night_start_hour, 'set', on_grow_session_hour_changed, retval=True)
db.event.listen(GrowSession, 'after_update', after_grow_session_update)

appbuilder.add_view(EventLogModelView, "EventLog", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(GrowSessionModelView, "GrowSessions", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(LightDeviceModelView, "LightDevices", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(WaterDeviceModelView, "WaterDevices", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(FlowerDeviceModelView, "FlowerDevices", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(FlowerDataModelView, "FlowerData", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(SubscriberModelView, "Subscriber", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(WebcamModelView, "Webcam", icon="fa-folder-open-o", category="Manage",
                    category_icon="fa-envelope")
appbuilder.add_view(FlowerDataChartView, "FlowerData", icon="fa-folder-open-o", category="View",
Esempio n. 10
0
from flask import flash
from flask_appbuilder import SimpleFormView, ModelView
from flask_babel import lazy_gettext as _
from .models import MyForm
from app import appbuilder, db


class MyFormView(SimpleFormView):
    form = MyForm
    form_title = 'This is my first form view'
    message = 'My form submitted'

    def form_get(self, form):
        form.field1.data = 'This was prefilled'

    def form_post(self, form):
        # post process form
        flash(self.message, 'info')


appbuilder.add_view(MyFormView,
                    "My form View",
                    icon="fa-group",
                    label=_('My form View'),
                    category="My Forms",
                    category_icon="fa-cogs")
Esempio n. 11
0
from flask_appbuilder import AppBuilder, BaseView, expose, has_access
from app import appbuilder
from flask import redirect


class MyView(BaseView):

    default_view = 'method1'

    @expose('/method1/')
    @has_access
    def method1(self):
        self.update_redirect()
        return redirect('http://localhost:8088')


appbuilder.add_view(MyView, "Superset", category='My View')
Esempio n. 12
0
    group_by_columns = ['group', 'gender']
    datamodel = SQLAModel(Contact)


fixed_translations_import = [
    _("List Groups"),
    _("Manage Groups"),
    _("List Contacts"),
    _("Contacts Chart"),
    _("Contacts Birth Chart")
]

db.create_all()
fill_gender()
appbuilder.add_view(GroupMasterView,
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(GroupGeneralView,
                    "Manage Groups",
                    icon="fa-folder-open-o",
                    category="Contacts")
appbuilder.add_view(ContactGeneralView,
                    "List Contacts",
                    icon="fa-envelope",
                    category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView,
                    "Contacts Chart",
                    icon="fa-dashboard",
                    category="Contacts")
Esempio n. 13
0
        'taxid': 'Tax ID'
    }
    list_columns = ['name', 'notes']


class PersonChartView(GroupByChartView):
    datamodel = SQLAModel(Person)
    chart_title = 'Grouped Persons'
    label_columns = PersonModelView.label_columns
    chart_type = 'PieChart'

    definitions = [{
        'group': 'person_group',
        'series': [(aggregate_count, 'person_group')]
    }]


db.create_all()
appbuilder.add_view(GroupModelView(),
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts")
appbuilder.add_view(PersonModelView(),
                    "List Contacts",
                    icon="fa-envelope",
                    category="Contacts")
appbuilder.add_view(PersonChartView(),
                    "Contacts Chart",
                    icon="fa-dashboard",
                    category="Contacts")
Esempio n. 14
0
# Import the client API
from rest_api import ClientApi
# Import the views we defined in the ``routes`` module
from routes import PublicView, PrivateView

# Add these vews without a menu:
appbuilder.add_view_no_menu(ClientApi())
appbuilder.add_view_no_menu(PrivateView())
appbuilder.add_view_no_menu(PublicView())

# Add the modelviews with a menu:

# Category 'Blog'
appbuilder.add_view(EntryView,
                    "Entries",
                    category="Blog",
                    icon="fa-file-text",
                    category_icon="fa-rss")
appbuilder.add_view(CommentView,
                    "Comments",
                    category="Blog",
                    icon="fa-comments")  #, category_icon="fa-comments")
appbuilder.add_view(TagView, "Tags", category="Blog",
                    icon="fa-tags")  #, category_icon="fa-tags")
appbuilder.add_view(CategoryView,
                    "Categories",
                    category="Blog",
                    icon="fa-folder")  #, category_icon="fa-folder")
appbuilder.add_view(AuthorView, "Authors", category="Blog",
                    icon="fa-users")  #, category_icon="fa-envelope")
appbuilder.add_view(SidebarModuleView,
Esempio n. 15
0
#    datamodel = SQLAInterface(DetailTable, db.session)

#class MasterView(MasterDetailView):
#    datamodel = SQLAInterface(MasterTable, db.session)
#    related_views = [DetailView]

# How to create a MultipleView
#class MultipleViewsExp(MultipleView):
#    views = [GroupModelView, ContactModelView]

#View Registration
db.create_all()
fill_gender()

appbuilder.add_view(LawyerChartView(),
                    'Lawyer Age Chart',
                    icon='fa-dashboard',
                    category='Reports')
appbuilder.add_view(LawyerTimeChartView(),
                    'Lawyer Time Chart',
                    icon='fa-dashboard',
                    category='Reports')

appbuilder.add_view(PlaintiffChartView(),
                    'Plaintiff Age Chart',
                    icon='fa-dashboard',
                    category='Reports')
appbuilder.add_view(PlaintiffTimeChartView(),
                    'Plaintiff Time Chart',
                    icon='fa-dashboard',
                    category='Reports')
Esempio n. 16
0
class ProjectFilesModelView(ModelView):
    datamodel = SQLAInterface(ProjectFiles)

    label_columns = {'file_name': 'File Name', 'download': 'Download'}
    add_columns = ['file', 'description','project']
    edit_columns = ['file', 'description','project']
    list_columns = ['file_name', 'download']
    show_columns = ['file_name', 'download']


class ProjectModelView(CompactCRUDMixin, ModelView):
    datamodel = SQLAInterface(Project)
    related_views = [ProjectFilesModelView]

    show_template = 'appbuilder/general/model/show_cascade.html'
    edit_template = 'appbuilder/general/model/edit_cascade.html'

    add_columns = ['name']
    edit_columns = ['name']
    list_columns = ['name', 'created_by', 'created_on', 'changed_by', 'changed_on']
    show_fieldsets = [
        ('Info', {'fields': ['name']}),
        ('Audit', {'fields': ['created_by', 'created_on', 'changed_by', 'changed_on'], 'expanded': False})
    ]


db.create_all()
appbuilder.add_view(ProjectModelView, "List Projects", icon="fa-table", category="Projects")
appbuilder.add_view_no_menu(ProjectFilesModelView)
Esempio n. 17
0
            'group': 'month_year',
            'formatter': pretty_month_year,
            'series': [(aggregate_count, 'contact_groups')]
        },
        {
            'group': 'year',
            'formatter': pretty_year,
            'series': [(aggregate_count, 'contact_groups')]
        }
    ]


db.create_all()
fill_gender()

appbuilder.add_view(PSView, "List PS", icon="fa-folder-open-o", category="Contacts", category_icon='fa-envelope')
appbuilder.add_view(GroupModelView, "List Groups", icon="fa-folder-open-o", category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(ContactModelView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactModelView2, "List Contacts 2", icon="fa-envelope", category="Contacts")
appbuilder.add_view(FloatModelView, "List Float Model", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView, "Contacts Chart", icon="fa-dashboard", category="Contacts")
appbuilder.add_view(ContactTimeChartView, "Contacts Birth Chart", icon="fa-dashboard", category="Contacts")

appbuilder.add_view(ProductManufacturerView, "List Manufacturer", icon="fa-folder-open-o", category="Products",
                    category_icon='fa-envelope')
appbuilder.add_view(ProductModelView, "List Models", icon="fa-envelope", category="Products")
appbuilder.add_view(ProductView, "List Products", icon="fa-envelope", category="Products")

Esempio n. 18
0
        return self.render_template('upload.html')


@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html',
                           base_template=appbuilder.base_template,
                           appbuilder=appbuilder), 404


db.create_all()

# Risorse Bapco
appbuilder.add_view(AskBapcoView,
                    "Richiesta Codifica",
                    icon="fa-paper-plane",
                    category="Ask Bapco",
                    category_icon='fa-bold')
appbuilder.add_view(Uploadcodes,
                    "Update from XLSX",
                    icon="fa-paper-plane",
                    category="Ask Bapco",
                    category_icon='fa-bold')
#appbuilder.add_view_no_menu(DocRequestsView)
appbuilder.add_view(DocRequestsView,
                    "Engineering Code Request",
                    icon="fa-paper-plane",
                    category="Ask Bapco",
                    category_icon='fa-bold')

appbuilder.add_view(VendorRequestsView,
Esempio n. 19
0
class ProjectFilesModelView(ModelView):
    datamodel = SQLAModel(ProjectFiles)

    label_columns = {'file_name': 'File Name', 'download': 'Download'}
    add_columns = ['file', 'description','project']
    edit_columns = ['file', 'description','project']
    list_columns = ['file_name', 'download']
    show_columns = ['file_name', 'download']


class ProjectModelView(CompactCRUDMixin, ModelView):
    datamodel = SQLAModel(Project)
    related_views = [ProjectFilesModelView]

    show_template = 'appbuilder/general/model/show_cascade.html'
    edit_template = 'appbuilder/general/model/edit_cascade.html'

    add_columns = ['name']
    edit_columns = ['name']
    list_columns = ['name', 'created_by', 'created_on', 'changed_by', 'changed_on']
    show_fieldsets = [
        ('Info', {'fields': ['name']}),
        ('Audit', {'fields': ['created_by', 'created_on', 'changed_by', 'changed_on'], 'expanded': False})
    ]


db.create_all()
appbuilder.add_view(ProjectModelView, "List Projects", icon="fa-table", category="Projects")
appbuilder.add_view_no_menu(ProjectFilesModelView)
Esempio n. 20
0
    add_form_extra_fields = {'content': CKTextAreaField('Content')}
    edit_form_extra_fields = {'content': CKTextAreaField('Content')}

    add_columns = ['content']
    edit_columns = ['content']
    list_columns = ['content']
    show_columns = ['content']


"""
    Application wide 404 error handler
"""


@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html',
                           base_template=appbuilder.base_template,
                           appbuilder=appbuilder), 404


db.create_all()

appbuilder.add_view(TestMView,
                    "Test Test",
                    label=("test test"),
                    icon="fa-folder-open-o",
                    category="Test",
                    category_label=('test test'),
                    category_icon='fa-users')
Esempio n. 21
0
class RM_RoleModelView(ModelView):
    """TODO: Document me"""
    datamodel = SQLAInterface(RolemasterRole)

    list_columns = ['name', 'organization']
    related_views = [RM_AccountabilityModelView, RM_DomainModelView, RM_RoleFillingModelView]

class RM_OrganizationModelView(ModelView):
    """TODO: Document me"""
    datamodel = SQLAInterface(Organization)

    list_columns = ['name', 'description']

    related_views = [RM_OrganizationMembershipModelView]
    #label_columns = {}
    #show_fieldsets = []


db.create_all()

appbuilder.add_view(RM_OrganizationModelView, "List Organizations")
#appbuilder.add_view(RM_OrganizationMembershipModelView, "List Organization Members", category="Organization")
appbuilder.add_view_no_menu(RM_OrganizationMembershipModelView)
appbuilder.add_view(RM_RoleModelView, "List Roles")
appbuilder.add_view_no_menu(RM_AccountabilityModelView)
appbuilder.add_view_no_menu(RM_DomainModelView)
appbuilder.add_view_no_menu(RM_RoleFillingModelView)


Esempio n. 22
0
        'group': 'month_year',
        'formatter': pretty_month_year,
        'series': [(aggregate_count, 'group')]
    }, {
        'group': 'year',
        'formatter': pretty_year,
        'series': [(aggregate_count, 'group')]
    }]


db.create_all()
fill_gender()

appbuilder.add_view(PSView,
                    "List PS",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(GroupModelView,
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(ContactModelView,
                    "List Contacts",
                    icon="fa-envelope",
                    category="Contacts")
appbuilder.add_view(ContactModelView2,
                    "List Contacts 2",
                    icon="fa-envelope",
                    category="Contacts")
Esempio n. 23
0
        return response


@appbuilder.app.errorhandler(404)
def page_not_found(e):
    """
        Application wide 404 error handler
    """
    return render_template(
        '404.html', base_template=appbuilder.base_template,
        appbuilder=appbuilder), 404

db.create_all()

appbuilder.add_view(
    ImplantModelView, "List Implants", icon="fa-laptop",
    category="Implants", category_icon="fa-laptop")
appbuilder.add_view(
    TaskModelView, "List Tasks", icon="fa-tasks", category="Tasks",
    category_icon="fa-tasks")

appbuilder.add_view(
    DataStoreModelView, "Show Data Store", icon="fa-usd",
    category="Data Store", category_icon="fa-usd")
appbuilder.add_view(
    LogModelView, "Show Log", icon="fa-file-text-o", category="Log",
    category_icon="fa-file-text-o")
appbuilder.add_view(
    BeaconModelView, "List Beacon", icon="fa-filter", category="Beacons",
    category_icon="fa-filter")
Esempio n. 24
0
        self.update_redirect()
        datas = db.session.query(iPhone).filter_by(id=103).all()
        list_columns = [
            'img', 'models', 'iPhonesize', 'chip', 'wifi', 'USB_type'
        ]
        return self.render_template('iphone.html',
                                    datas=datas,
                                    list_columns=list_columns)


db.create_all()
""" Page View """

# appbuilder.add_view(Register, 'Register', category="Sam")

appbuilder.add_view(mac, 'MacBook Air', category="Mac")
appbuilder.add_link("MacBook Pro 13 inch",
                    href="/mac/MacBook_Pro_13/",
                    category="Mac")
appbuilder.add_link("MacBook Pro 16 inch",
                    href="/mac/MacBook_Pro_16/",
                    category="Mac")

appbuilder.add_view(iphone, "iphone12 Pro", category='iPhone')
appbuilder.add_link("iphone12", href="/iphone/iphone12/", category="iPhone")
appbuilder.add_link("iphone11", href="/iphone/iphone11/", category="iPhone")
appbuilder.add_link("iphoneSE", href="/iphone/iphoneSE/", category="iPhone")

appbuilder.add_view(ipad, 'iPad Pro', category="iPad")
appbuilder.add_link("iPad Air", href="/ipad/iPadAir/", category="iPad")
appbuilder.add_link("iPad", href="/ipad/iPad/", category="iPad")
Esempio n. 25
0
import calendar
from flask.ext.appbuilder import ModelView
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask.ext.appbuilder.charts.views import GroupByChartView
from flask.ext.appbuilder.models.group import aggregate_count
from flask.ext.babelpkg import lazy_gettext as _


from app import db, appbuilder
from .models import Parent, Child


class ChildView(ModelView):
    datamodel = SQLAInterface(Child)


class ParentView(ModelView):
    datamodel = SQLAInterface(Parent)
    related_views = [ChildView]


db.create_all()
appbuilder.add_view(ParentView, "Parent", icon="fa-folder-open-o", category="Stuff", category_icon="fa-envelope")
appbuilder.add_view(ChildView, "Child", icon="fa-folder-open-o", category="Stuff", category_icon="fa-envelope")
Esempio n. 26
0
    datamodel = SQLAInterface(Muracaat)

class MuracaatEvrakModelView(ModelView):             #siraya diz
    datamodel = SQLAInterface(Muracaat_Evrak)


"""
    Application wide 404 error handler
"""
@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html', base_template=appbuilder.base_template, appbuilder=appbuilder), 404

db.create_all()

appbuilder.add_view(UstGrupModelView, "Ust Grup", icon="fa-envelope", category="Sabitler")
appbuilder.add_view(Izin_GrupModelView, "Grup", icon="fa-envelope", category="Sabitler")
appbuilder.add_view(Izin_TurModelView, "Tur", icon="fa-envelope", category="Sabitler")
appbuilder.add_view(Izin_AltTurModelView, "Alt Tur", icon="fa-envelope", category="Sabitler")

from flask.ext.appbuilder import MultipleView

class MultipleViewsExp(MultipleView):
    views = [UstGrupModelView, Izin_GrupModelView, Izin_TurModelView, Izin_AltTurModelView]
    
appbuilder.add_view(MultipleViewsExp, "Izin Toplu", icon="fa-envelope", category="Sabitler")

appbuilder.add_separator("Sabitler")
appbuilder.add_view(BolgeMudModelView, "Bolge Mud", icon="fa-envelope", category="Sabitler")
appbuilder.add_view(IsletmeMudModelView, "Isletme Mud", icon="fa-envelope", category="Sabitler")
appbuilder.add_view(SeflikModelView, "Seflik", icon="fa-envelope", category="Sabitler")
Esempio n. 27
0
from flask_appbuilder import ModelView
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.models.sqla.filters import FilterEqualFunction
from app import db, appbuilder
from .models import ContactGroup, Gender, Contact

def get_user():
    return g.user


class ContactModelView(ModelView):
    datamodel = SQLAInterface(Contact)
    list_columns = ['name', 'personal_celphone', 'birthday', 'contact_group.name','created_by.username']
    add_columns = ['name', 'address','birthday','personal_phone','personal_celphone','contact_group','gender']
    edit_columns = ['name', 'address','birthday','personal_phone','personal_celphone','contact_group','gender']
    base_order = ('name', 'asc')
    base_filters = [['created_by', FilterEqualFunction, get_user]]



class GroupModelView(ModelView):
    datamodel = SQLAInterface(ContactGroup)
    related_views = [ContactModelView]


db.create_all()
appbuilder.add_view(GroupModelView, "List Groups", icon="fa-folder-open-o", category="Contacts", category_icon='fa-envelope')
appbuilder.add_view(ContactModelView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")

Esempio n. 28
0
    list_widget = ListThumbnail


class SiteFrameView(BaseView):
    default_view = 'navigate'

    @expose('/navigate')
    def navigate(self):
        item = db.session.query(Page).filter_by(id=1).first()
        return render_template('pages.html', items=item)


db.create_all()

appbuilder.add_view(AboutView,
                    "About",
                    icon="fa-folder-open-o",
                    category="Admin")
appbuilder.add_view(SiteFrameView,
                    "Site Frame",
                    icon="fa-folder-open-o",
                    category="Admin")
appbuilder.add_view(NewsView,
                    "News",
                    icon="fa-folder-open-o",
                    category="Admin")
appbuilder.add_view(ActivityView,
                    "Activities",
                    icon="fa-folder-open-o",
                    category="Admin")
appbuilder.add_view(MessageView,
                    "Messages",
Esempio n. 29
0

class Report_pageview(BaseView):
    default_view = 'Report_view'

    @expose('Report_view')
    def Report_view(self):
        data = db.session.query(Report).all()
        self.update_redirect()
        return self.render_template('report.html', data=data)


db.create_all()
""" Page View """
appbuilder.add_view(Careers_with_usPageView,
                    'Careers With Us',
                    category="Careers")
appbuilder.add_view(NewsPageView, 'Local News', category="News")
appbuilder.add_link("Global News",
                    href="/newspageview/global_news/",
                    category="News")
appbuilder.add_view(investing_in_pccw_pageview,
                    'investing in pccw',
                    category="Investor Relations")
appbuilder.add_view(Investing_in_PCCW_view_inputed_data,
                    'Investing_in_PCCW_view_inputed_data',
                    category="Investor Relations")
'''appbuilder.add_link("investing in pccw", href="/investor_relations_view/investing_in_pccw_view/", category="Investor Relations")'''
appbuilder.add_view(Financial_Results_table_view,
                    'Financial_Results_table',
                    category="Investor Relations")
Esempio n. 30
0
from app import appbuilder, db
from wtforms.fields import TextField
from .models import Device, Site, DeviceType, LowerCaseString


class MySQLAInterface(SQLAInterface):
    def is_string(self, col_name):
        try:
            return (isinstance(self.list_columns[col_name].type, sa.types.String) or
                    isinstance(self.list_columns[col_name].type, LowerCaseString))
        except:
            return False

class SiteModelView(ModelView):
    datamodel = SQLAInterface(Site)


class DeviceTypeModelView(ModelView):
    datamodel = SQLAInterface(DeviceType)


class DeviceModelView(ModelView):
    datamodel = MySQLAInterface(Device)
    
db.create_all()

appbuilder.add_view(SiteModelView, "Site", icon="fa-folder-open-o", category="Management", category_icon='fa-envelope')
appbuilder.add_view(DeviceTypeModelView, "DeviceType", icon="fa-folder-open-o", category="Management", category_icon='fa-envelope')
appbuilder.add_view(DeviceModelView, "Devices", icon="fa-folder-open-o", category="Management", category_icon='fa-envelope')

Esempio n. 31
0
    @expose("/learning_center/")
    def learning_center(self):
        param1 = "learning center"
        self.update_redirect()
        return self.render_template("learning center.html", param1=param1)

    @expose("/Xamarin/")
    def Xamarin(self):
        param1 = "Xamarin"
        self.update_redirect()
        return self.render_template("Xamarin.html", param1=param1)


db.create_all()
""" Page View """
appbuilder.add_view(NewsPageView, 'Local News', category="News")
appbuilder.add_link("Global News",
                    href="/newspageview/global_news/",
                    category="News")

appbuilder.add_view(MicrosoftView,
                    "learning center",
                    category="Learning center")
appbuilder.add_link("Xamarin",
                    href="/microsoftview/Xamarin/",
                    category="Learning center")
""" Custom Views """
appbuilder.add_view(MenuItemView,
                    "MenuItem",
                    icon="fa-folder-open-o",
                    category="Admin")
Esempio n. 32
0

class GroupGeneralView(ModelView):
    datamodel = SQLAInterface(ContactGroup)
    related_views = [ContactGeneralView]


fixed_translations_import = [
    _("List Groups"),
    _("Manage Groups"),
    _("List Contacts"),
    _("Contacts Chart"),
    _("Contacts Birth Chart")
]

db.create_all()
fill_gender()
appbuilder.add_view(GroupMasterView,
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(GroupGeneralView,
                    "Manage Groups",
                    icon="fa-folder-open-o",
                    category="Contacts")
appbuilder.add_view(ContactGeneralView,
                    "List Contacts",
                    icon="fa-envelope",
                    category="Contacts")
Esempio n. 33
0
class SubmissionFormView(SimpleFormView):
    form = SubmissionForm
    form_title = 'User Submission Form'
    message = 'Form Submitted'

    def form_get(self, form):
        form.field1.data = 'Prefilled Text'

    def form_post(self, form):
        # post process form
        flash(self.message, 'info')


appbuilder.add_view(SubmissionFormView,
                    "Form",
                    icon="fa-group",
                    label=_('Form'),
                    category="Forms",
                    category_icon="fa-cogs")


class ContactModelView(ModelView):
    datamodel = SQLAInterface(Contact)

    label_columns = {'contact_group': 'Contacts Group'}
    list_columns = ['name', 'personal_cellphone', 'birthday', 'contact_group']

    show_fieldsets = [
        ('Summary', {
            'fields': ['name', 'address', 'contact_group']
        }),
        ('Personal Info', {
Esempio n. 34
0
appbuilder.add_view_no_menu(MetricInlineView)


class ClusterModelView(ModelView, DeleteMixin):
    datamodel = SQLAInterface(models.Cluster)
    add_columns = [
        'cluster_name',
        'coordinator_host', 'coordinator_port', 'coordinator_endpoint',
        'broker_host', 'broker_port', 'broker_endpoint',
    ]
    edit_columns = add_columns
    list_columns = ['cluster_name', 'metadata_last_refreshed']

appbuilder.add_view(
    ClusterModelView,
    "Druid Clusters",
    icon="fa-server",
    category="Admin",
    category_icon='fa-cogs',)


class DatabaseView(ModelView, DeleteMixin):
    datamodel = SQLAInterface(models.Database)
    list_columns = ['database_name']
    add_columns = ['database_name', 'sqlalchemy_uri']
    edit_columns = add_columns

appbuilder.add_view(
    DatabaseView,
    "Databases",
    icon="fa-database",
    category="Admin",
Esempio n. 35
0
    show_template = 'appbuilder/general/model/show_cascade.html'


class FunctionView(ModelView):
    datamodel = SQLAInterface(Function)
    related_views = [EmployeeView]


class DepartmentView(ModelView):
    datamodel = SQLAInterface(Department)
    related_views = [EmployeeView]


class BenefitView(ModelView):
    datamodel = SQLAInterface(Benefit)
    add_columns = ['name']
    edit_columns = ['name']
    show_columns = ['name']
    list_columns = ['name']


db.create_all()

appbuilder.add_view_no_menu(EmployeeHistoryView, "EmployeeHistoryView")
appbuilder.add_view(EmployeeView, "Employees", icon="fa-folder-open-o", category="Company")
appbuilder.add_separator("Company")
appbuilder.add_view(DepartmentView, "Departments", icon="fa-folder-open-o", category="Company")
appbuilder.add_view(FunctionView, "Functions", icon="fa-folder-open-o", category="Company")
appbuilder.add_view(BenefitView, "Benefits", icon="fa-folder-open-o", category="Company")

Esempio n. 36
0
class MyFormView(SimpleFormView):
    form = MyForm
    form_title = 'This is my first form view'
    message = 'My form submitted'

    def form_get(self, form):
        form.field1.data = 'This was prefilled'

    def form_post(self, form):
        # post process form
        flash(self.message, 'info')


#appbuilder.add_view_no_menu(MyView())
appbuilder.add_view(MyView, "Method1", category='My View')
appbuilder.add_link("Method2", href='/myview/method2/john', category='My View')
appbuilder.add_link("Method3", href='/myview/method3/john', category='My View')
appbuilder.add_view(MyFormView,
                    "My form View",
                    icon="fa-group",
                    label=_('My form View'),
                    category="My Forms",
                    category_icon="fa-cogs")


class BS3TextFieldROWidget(BS3TextFieldWidget):
    def __call__(self, field, **kwargs):
        kwargs['readonly'] = 'true'
        return super(BS3TextFieldROWidget, self).__call__(field, **kwargs)
Esempio n. 37
0
        ('Extended', {'fields': ['name', 'text', 'question1', 'question2'], 'expanded': False}),
    ]


"""
    Application wide 404 error handler
"""


@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html', base_template=appbuilder.base_template, appbuilder=appbuilder), 404


db.create_all()
appbuilder.add_view(InvitationView(), "Invitations")


class MapView(BaseView):
    default_view = 'map'

    @has_access
    @expose('/map/')
    @permission_name('LoginRequired')
    def map(self):
        assist_classes = 'selected-button' if g.user.assist is True else ''
        not_assist_classes = 'selected-button' if g.user.assist is False else ''
        return self.render_template('map.html', assist_classes=assist_classes, not_assist_classes=not_assist_classes)

    @has_access
    @expose('/assist/')
Esempio n. 38
0
#class DetailView(ModelView):
#    datamodel = SQLAInterface(DetailTable, db.session)

#class MasterView(MasterDetailView):
#    datamodel = SQLAInterface(MasterTable, db.session)
#    related_views = [DetailView]

# How to create a MultipleView
#class MultipleViewsExp(MultipleView):
#    views = [GroupModelView, ContactModelView]

#View Registration

appbuilder.add_view(AttorneyView,
                    "Attorneys",
                    icon="fa-folder-open-o",
                    category="Setup")

appbuilder.add_view(BailView,
                    "Bails",
                    icon="fa-folder-open-o",
                    category="Setup")

appbuilder.add_view(CaseView,
                    "Cases",
                    icon="fa-folder-open-o",
                    category="Setup")

appbuilder.add_view(CauseofactionView,
                    "Causeofactions",
                    icon="fa-folder-open-o",
Esempio n. 39
0
    field1 = StringField(('First Name'),
        description=('Your field number one!'),
        validators = [DataRequired()], widget=BS3TextFieldWidget())
    field2 = StringField(('Last Name'),
        description=('Your field number two!'), widget=BS3TextFieldWidget())
    field3 = DateField (('Date'), format='%m/%d/%Y' ,widget =DatePickerWidget() )

class MyFormView(SimpleFormView):
    form = MyForm
    form_title = 'This is my first form view'
    message = 'My form submitted'

    def form_get(self, form):
        form.field1 = 'This was prefilled'

    def form_post(self, form):
        # post process form
        flash(self.message, 'info')

appbuilder.add_view(MyFormView, "My form View", icon="fa-group", label=_('My form View'),
                     category="My Forms", category_icon="fa-cogs")

db.create_all()



#appbuilder.add_view(MyView(), "Method2", href='/myview/method2/jonh', category='My View')
# Use add link instead there is no need to create MyView twice.
appbuilder.add_link("View Terminals", href='/Terminals/View Terminals/jonh', category='Terminals')
#appbuilder.add_link("Method3", href='/Terminals/method3/jonh', category='Terminals')
appbuilder.add_view(DepartmentView, "Create Terminals", icon="fa-folder-open-o", category="Terminals")
Esempio n. 40
0
class ActivityView(ModelView):
    datamodel = SQLAInterface(Activity)
    list_columns = ['activity']


class HistoryView(ModelView):
    datamodel = SQLAInterface(History)
    base_filters = [['created_by', FilterEqualFunction, get_user]]
    list_columns = ['date', 'project', 'activity', 'quantity']
    edit_columns = ['date', 'project', 'activity', 'quantity']
    add_columns = ['date', 'project', 'activity', 'quantity']


appbuilder.add_view(ProjectView,
                    "Project",
                    icon="fa-folder-open-o",
                    category="Project",
                    category_icon='fa-folder-open-o')
appbuilder.add_view(ActivityView,
                    "Activity",
                    icon="fa-folder-open-o",
                    category="Project",
                    category_icon='fa-folder-open-o')
appbuilder.add_view(HistoryView,
                    "Task",
                    icon="fa-folder-open-o",
                    category="Pending Task",
                    category_icon='fa-folder-open-o')
"""
    Application wide 404 error handler
"""
        ('Extra', {'fields': ['notes'], 'expanded': False}),
    ]


class GroupModelView(ModelView):
    datamodel = SQLAInterface(PersonGroup, db.session)
    related_views = [PersonModelView]

    label_columns = {'phone1': 'Phone (1)', 'phone2': 'Phone (2)', 'taxid': 'Tax ID'}
    list_columns = ['name', 'notes']


class PersonChartView(GroupByChartView):
    datamodel = SQLAInterface(Person)
    chart_title = 'Grouped Persons'
    label_columns = PersonModelView.label_columns
    chart_type = 'PieChart'

    definitions = [
        {
            'group': 'person_group',
            'series': [(aggregate_count,'person_group')]
        }
    ]


db.create_all()
appbuilder.add_view(GroupModelView(), "List Groups", icon="fa-folder-open-o", category="Contacts")
appbuilder.add_view(PersonModelView(), "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(PersonChartView(), "Contacts Chart", icon="fa-dashboard", category="Contacts")
    ]
    """
        [{
            '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}


db.create_all()
#fill_data()
appbuilder.add_view(CountryModelView, "List Countries", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_view(PoliticalTypeModelView, "List Political Types", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_view(CountryStatsModelView, "List Country Stats", icon="fa-folder-open-o", category="Statistics")
appbuilder.add_separator("Statistics")
appbuilder.add_view(CountryStatsDirectChart, "Show Country Chart", icon="fa-dashboard", category="Statistics")
appbuilder.add_view(CountryGroupByChartView, "Group Country Chart", icon="fa-dashboard", category="Statistics")
appbuilder.add_view(CountryDirectChartView, "Show Country Chart", icon="fa-dashboard", category="Statistics")

Esempio n. 43
0
            from email_client import Client
            self.client = Client()
            self.client.start()
        elif 'client' in self.__dict__:
            self.client.exit()


@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template(
        '404.html',
        base_template=appbuilder.base_template,
        appbuilder=appbuilder), 404

db.create_all()

appbuilder.add_view(AppSettingsModelView, "Settings", icon="fa-cogs")
appbuilder.add_view(
    EmailModelView,
    "List Emails",
    icon="fa-envelope-o",
    category="Emails",
    category_icon="fa-envelope")
appbuilder.add_view_no_menu(AttachmentModelView)
appbuilder.add_view(
    ActionModelView,
    "List Actions",
    icon="fa-cogs",
    category="Actions",
    category_icon="fa-cogs")
Esempio n. 44
0
    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')]
    }]


appbuilder.add_view(GroupModelView,
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(ContactModelView,
                    "List Contacts",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_view(TagsModelView,
                    "List Tags",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon='fa-envelope')
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView,
                    "Contacts Chart",
Esempio n. 45
0
    datamodel = SQLAInterface(projects_model)
    list_columns = [ 'name', 'description']
    related_views = [
            resources,
            ]


class project_users(ModelView):
    datamodel = SQLAInterface(project_users_model)


db.create_all()


################## Tab Menu : Project ##################
appbuilder.add_view(projects, "Projects", icon="fa-folder-open", category="Resource_Providers")
appbuilder.add_view(resources, "Resources", icon="fa-folder-open-o", category="Resource_Providers")
appbuilder.add_view(project_users, "project_users", icon="fa-folder-open", category="Resource_Providers")
appbuilder.add_view(resources_availability,'resAvail', icon="fa-folder-open-o", category="Resource_Providers")
appbuilder.add_view(resources_booking,'resBooking', icon="fa-folder-open-o", category="Resource_Providers")


################## Tab Menu : Check ##################
appbuilder.add_view(project, "Projects", href='/project/all', category='stakeholders')
# appbuilder.add_view(project, "Summary", href='/project/summary/12', category='stakeholders') # internal
# appbuilder.add_link("Availability", href='/project/availability/001', category='stakeholders') # internal
# appbuilder.add_link("Bookings", href='/project/bookings/001', category='stakeholders') # internal
appbuilder.add_link("Help", href='/project/help/', category='Help')
appbuilder.add_link("Test", href='/project/test/', category='Test')
appbuilder.add_link("Method4", href='/project/method4/12', category='stakeholders')
appbuilder.add_link("Method5", href='/project/method5', category='stakeholders')
Esempio n. 46
0
                'created_by': result.created_by.username,
                'changed_on': result.changed_on
            },
            'data_set_attributes': [{
                'column_name':
                attr.column_name,
                'attribute_description':
                attr.attribute_description,
                'datatype':
                attr.data_type.datatype_name,
                'count_of_unique_values':
                attr.count_of_unique_values,
                'count_of_null_values':
                attr.count_of_null_values
            } for attr in datasetattrs]
        } for result in results]
        #return str(datasets)
        path = download_excel(datasets, 'data_set')
        return send_file(path, as_attachment=True)


appbuilder.add_view(DataSetView,
                    "Data Sets",
                    category="Data",
                    href='/data_set/list_new')
appbuilder.add_view(DataSetView,
                    "Data Sets Admin",
                    category="Data",
                    href='/data_set/list/')
appbuilder.add_view_no_menu(DataSetAttachmentView)
Esempio n. 47
0
    base_permissions = ['can_list', 'can_show']
    list_widget = ListBlock
    show_widget = ShowBlockWidget

    label_columns = {'photo_img': 'Photo'}

    list_columns = ['name', 'photo_img', 'price_label']
    search_columns = ['name', 'price', 'product_type']

    show_fieldsets = [
        ('Summary', {'fields': ['name', 'price_label', 'photo_img', 'product_type']}),
        (
            'Description',
            {'fields': ['description'], 'expanded': True}),
    ]

class ProductView(ModelView):
    datamodel = SQLAInterface(Product)

class ProductTypeView(ModelView):
    datamodel = SQLAInterface(ProductType)
    related_views = [ProductView]


db.create_all()
appbuilder.add_view(ProductPubView, "Our Products", icon="fa-folder-open-o")
appbuilder.add_view(ProductView, "List Products", icon="fa-folder-open-o", category="Management")
appbuilder.add_separator("Management")
appbuilder.add_view(ProductTypeView, "List Product Types", icon="fa-envelope", category="Management")

Esempio n. 48
0
            },
            "grouptree": {
                'text':
                'Show all',
                'nodes': [{
                    'text': 'Beijing Station',
                    'nodes': [{
                        'text': 'Beijing1'
                    }, {
                        'text': 'Beijing2'
                    }]
                }, {
                    'text': 'Tianjin',
                    'nodes': [{
                        'text': 'Tianjin1'
                    }, {
                        'text': 'Tianjin2'
                    }]
                }, {
                    'text': 'Other'
                }]
            },
            "list":
            df.to_dict(orient='records')
        })


appbuilder.add_view(IpManagerView, "IP Manager")

db.create_all()
Esempio n. 49
0
from flask_babel import lazy_gettext as _
from .forms import MyForm
from app import appbuilder, db


class MyFormView(SimpleFormView):
    form = MyForm
    form_title = 'This is my first form view'
    message = 'My form was submitted'

    def form_get(self, form):
        form.field1.data = 'This was prefilled'

    def form_post(self, form):
        # post process form
        flash(self.message, 'info')

appbuilder.add_view(MyFormView, "My form View", icon="fa-group", label=_('My form View'),
                     category="My Forms", category_icon="fa-cogs")

"""
    Application wide 404 error handler
"""
@appbuilder.app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html', base_template=appbuilder.base_template, appbuilder=appbuilder), 404

db.create_all()


#    datamodel = SQLAInterface(DetailTable, db.session)

#class MasterView(MasterDetailView):
#    datamodel = SQLAInterface(MasterTable, db.session)
#    related_views = [DetailView]

# How to create a MultipleView
#class MultipleViewsExp(MultipleView):
#    views = [GroupModelView, ContactModelView]

#View Registration
db.create_all()
fill_gender()

appbuilder.add_view(AttorneyChartView(),
                    'Attorney Age Chart',
                    icon='fa-dashboard',
                    category='Reports')
appbuilder.add_view(AttorneyTimeChartView(),
                    'Attorney Time Chart',
                    icon='fa-dashboard',
                    category='Reports')

appbuilder.add_view(PlaintiffChartView(),
                    'Plaintiff Age Chart',
                    icon='fa-dashboard',
                    category='Reports')
appbuilder.add_view(PlaintiffTimeChartView(),
                    'Plaintiff Time Chart',
                    icon='fa-dashboard',
                    category='Reports')
Esempio n. 51
0
    list_columns = ['name','start_time','PAYLOAD']
    #add_columns = ['name', 'PAYLOAD']
    add_columns = []
    show_fieldsets = [
        ('Summary',{'fields':['name','PAYLOAD']}),
        ('Job Info',{'fields':['module_type', 'start_time','SRVHOST','SRVPORT','LHOST','LPORT'],'expanded':False}),
        ]

    @action("job_kill", "Kill", "Kill all selected?", "fa-rocket")
    def kill(self, items):
        if isinstance(items, list):
            for item in items:
                result = "test result"
                flash(str(item.id), "info")
                flash(str(result), "info")
        else:
                result = "test result"
                flash(str(items.id), "info")
                flash(str(result), "info")
        self.update_redirect()
        return redirect(self.get_redirect())

    @action("job_stop", "Stop", "Stop all selected?", "fa-rocket")
    def stop(self, items):
        print "stopping"
        return redirect(self.get_redirect())

appbuilder.add_view(JobModelView, "List Jobs",icon = "fa-folder-open-o",category = "Contacts",
                category_icon = "fa-envelope")
Esempio n. 52
0
class MClassView(ModelView):
    datamodel = SQLAInterface(MClass)


class TeacherView(ModelView):
    datamodel = SQLAInterface(Teacher)


class StudentView(ModelView):
    datamodel = SQLAInterface(Student)


db.create_all()

appbuilder.add_view(MyView, "Hello", category='My View')
appbuilder.add_link("Message", href='/myview/message/john', category='My View')
appbuilder.add_link("Welcome", href='/myview/welcome/student', category='My View')
appbuilder.add_view(GroupModelView,
                    "List Groups",
                    icon = "fa-address-book-o",
                    category = "Contacts",
                    category_icon = "fa-envelope")
appbuilder.add_view(ContactModelView,
                    "List Contacts",
                    icon = "fa-address-card-o",
                    category = "Contacts")

# appbuilder.add_view_no_menu(MyView())
# appbuilder.add_view_no_menu(MyView())
Esempio n. 53
0
    @expose("/method1/")
    @has_access
    def method1(self):
        # do something with param1
        # and return to previous page or index
        return "Hello"

    @expose("/method2/<string:param1>")
    @has_access
    def method2(self, param1):
        # do something with param1
        # and render template with param
        param1 = "Goodbye %s" % (param1)
        return param1

    @expose("/method3/<string:param1>")
    @has_access
    def method3(self, param1):
        # do something with param1
        # and render template with param
        param1 = "Goodbye %s" % (param1)
        return render_template("method3.html", param1=param1, appbuilder=self.appbuilder)


appbuilder.add_view(MyView(), "Method1", category="My View")
# appbuilder.add_view(MyView(), "Method2", href='/myview/method2/jonh', category='My View')
# Use add link instead there is no need to create MyView twice.
appbuilder.add_link("Method2", href="/myview/method2/jonh", category="My View")
appbuilder.add_link("Method3", href="/myview/method3/jonh", category="My View")
Esempio n. 54
0
# -*- coding:utf-8 -*-
"""
    :author: young
    :DATE: 2019/5/9 10:56
    :copyright: © 2019 young <*****@*****.**>
    :license: None, see LICENSE for more details.
"""
from app import appbuilder
from app.model_views import GroupModelView, ContactModelView

appbuilder.add_view(GroupModelView,
                    "List Groups",
                    icon="fa-folder-open-o",
                    category="Contacts",
                    category_icon="fa-envelope")
appbuilder.add_view(ContactModelView,
                    "List Contacts",
                    icon="fa-envelope",
                    category="Contacts")
Esempio n. 55
0
    chart_title = 'Grouped Birth contacts'
    chart_type = 'AreaChart'
    label_columns = ContactModelView.label_columns
    definitions = [
        {
            'group' : 'month_year',
            'formatter': pretty_month_year,
            'series': [(aggregate_count, 'group')]
        },
        {
            'group': 'year',
            'formatter': pretty_year,
            'series': [(aggregate_count, 'group')]
        }
    ]


db.create_all()
fill_gender()
appbuilder.add_view(GroupModelView, "List Groups", icon="fa-folder-open-o", category="Contacts", category_icon='fa-envelope')
appbuilder.add_view(ContactModelView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactLinkModelView, "List Links Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactItemModelView, "List Item Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactBlockModelView, "List Block Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_view(ContactThumbnailModelView, "List Thumb Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView, "Contacts Chart", icon="fa-dashboard", category="Contacts")
appbuilder.add_view(ContactTimeChartView, "Contacts Birth Chart", icon="fa-dashboard", category="Contacts")

Esempio n. 56
0
    base_permissions = ['can_list', 'can_show']
    list_widget = ListBlock
    show_widget = ShowBlockWidget

    label_columns = {'photo_img': 'Photo'}

    list_columns = ['name', 'photo_img', 'price_label']
    search_columns = ['name', 'price', 'product_type']

    show_fieldsets = [
        ('Summary', {'fields': ['name', 'price_label', 'photo_img', 'product_type']}),
        (
            'Description',
            {'fields': ['description'], 'expanded': True}),
    ]

class ProductView(ModelView):
    datamodel = SQLAInterface(Product)

class ProductTypeView(ModelView):
    datamodel = SQLAInterface(ProductType)
    related_views = [ProductView]


db.create_all()
appbuilder.add_view(ProductPubView, "Our Products", icon="fa-folder-open-o")
appbuilder.add_view(ProductView, "List Products", icon="fa-folder-open-o", category="Management")
appbuilder.add_separator("Management")
appbuilder.add_view(ProductTypeView, "List Product Types", icon="fa-envelope", category="Management")

Esempio n. 57
0
            'Personal Info',
            {'fields': ['address', 'birthday', 'personal_phone', 'personal_celphone'], 'expanded': False}),
    ]



class GroupMasterView(MasterDetailView):
    datamodel = SQLAInterface(ContactGroup)
    related_views = [ContactGeneralView]


class GroupGeneralView(ModelView):
    datamodel = SQLAInterface(ContactGroup)
    related_views = [ContactGeneralView]


fixed_translations_import = [
    _("List Groups"),
    _("Manage Groups"),
    _("List Contacts"),
    _("Contacts Chart"),
    _("Contacts Birth Chart")]

db.create_all()
fill_gender()
appbuilder.add_view(GroupMasterView, "List Groups", icon="fa-folder-open-o", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(GroupGeneralView, "Manage Groups", icon="fa-folder-open-o", category="Contacts")
appbuilder.add_view(ContactGeneralView, "List Contacts", icon="fa-envelope", category="Contacts")

###Li try



#HMK
class FrontPageImgView(ModelView):
    datamodel = SQLAInterface(FrontPage)
    list_columns = ['id', 'img_title', 'img_src']
    
    
   
    

db.create_all()
#KCY Review
appbuilder.add_view(PromotionDrinkView, "PromotionDrink", category="Drinks")
appbuilder.add_view(HealthDrinkView, "HealthDrink", category="Drinks")
appbuilder.add_view(AlcoholicBeveragesView, "AlcoholicBeverages", category="Drinks")
appbuilder.add_view(AlldrinksView, "Alldrinks", category="Drinks")

#hin try
appbuilder.add_view(FoodView, 'Biscuits', category="Food")
appbuilder.add_view(FoodsnackView, 'Snacks', category="Food")
appbuilder.add_view(FoodConfectioneryView, 'Confectionery', category="Food")

#Li try

#HMK try


Esempio n. 59
0
from flask.ext.appbuilder import BaseView, expose, has_access
from app import appbuilder


class MyView(BaseView):

    default_view = 'method1'

    @expose('/method1/')
    @has_access
    def method1(self):
        # do something with param1
        # and return to previous page or index
        return 'Hello'

    @expose('/method2/<string:param1>')
    @has_access
    def method2(self, param1):
        # do something with param1
        # and render template with param
        param1 = 'Goodbye %s' % (param1)
        return param1


appbuilder.add_view(MyView(), "Method1", category='My View')
#appbuilder.add_view(MyView(), "Method2", href='/myview/method2/jonh', category='My View')
# Use add link instead there is no need to create MyView twice.
appbuilder.add_link("Method2", href='/myview/method2/jonh', category='My View')
Esempio n. 60
0
class GroupGeneralView(ModelView):
    datamodel = SQLAModel(ContactGroup)
    related_views = [ContactGeneralView]


class ContactChartView(ChartView):
    chart_title = 'Grouped contacts'
    label_columns = ContactGeneralView.label_columns
    group_by_columns = ['contact_grouo', 'gender']
    datamodel = SQLAModel(Contact)


fixed_translations_import = [
    _("List Groups"),
    _("Manage Groups"),
    _("List Contacts"),
    _("Contacts Chart"),
    _("Contacts Birth Chart")]

db.create_all()
fill_gender()
appbuilder.add_view(GroupMasterView, "List Groups", icon="fa-folder-open-o", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(GroupGeneralView, "Manage Groups", icon="fa-folder-open-o", category="Contacts")
appbuilder.add_view(ContactGeneralView, "List Contacts", icon="fa-envelope", category="Contacts")
appbuilder.add_separator("Contacts")
appbuilder.add_view(ContactChartView, "Contacts Chart", icon="fa-dashboard", category="Contacts")
appbuilder.add_view(ContactTimeChartView, "Contacts Birth Chart", icon="fa-dashboard", category="Contacts")