Skip to content

Commit

Permalink
Docs, remove deprecated import of flask.ext.appbuilder, better exampl…
Browse files Browse the repository at this point in the history
…e code readability
  • Loading branch information
dpgaspar committed Jun 21, 2017
1 parent 4eb5bd2 commit 3784431
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 99 deletions.
6 changes: 3 additions & 3 deletions docs/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Just use the @action decorator on your own functions. Here's an example

::

from flask.ext.appbuilder.actions import action
from flask.ext.appbuilder import ModeView
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.actions import action
from flask_appbuilder import ModeView
from flask_appbuilder.models.sqla.interface import SQLAInterface

class GroupModelView(ModelView):
datamodel = SQLAInterface(Group)
Expand Down
2 changes: 1 addition & 1 deletion docs/addons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ A very simple manager would look something like this::


import logging
from flask.ext.appbuilder.basemanager import BaseManager
from flask_appbuilder.basemanager import BaseManager
from flask_babelpkg import lazy_gettext as _
from .views import FirstModelView1
from .model import MyModel
Expand Down
8 changes: 4 additions & 4 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ and then use the **@renders** decorator to tell the framework to map you class m
with a certain Model property::

from flask.ext.appbuilder.models.decorators import renders
from flask_appbuilder.models.decorators import renders

class MyModel(Model):
id = Column(Integer, primary_key=True)
Expand Down Expand Up @@ -61,8 +61,8 @@ On this next example we are filtering a view by the logged in user and with colu


from flask import g
from flask.ext.appbuilder import ModelView
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder import ModelView
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.models.sqla.filters import FilterStartsWith, FilterEqualFunction
# If your using Mongo Engine you should import filters like this, everything else is exactly the same
# from flask_appbuilder.models.mongoengine.filters import FilterStartsWith, FilterEqualFunction
Expand Down Expand Up @@ -196,7 +196,7 @@ Forms - Custom query on related fields

You can create a custom query filter for all related columns like this::

from flask.ext.appbuilder.models.sqla.filters import FilterStartsWith
from flask_appbuilder.models.sqla.filters import FilterStartsWith


class ContactModelView(ModelView):
Expand Down
48 changes: 24 additions & 24 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
API Reference
=============

flask.ext.appbuilder
flask_appbuilder
====================

AppBuilder
----------

.. automodule:: flask.ext.appbuilder.base
.. automodule:: flask_appbuilder.base

.. autoclass:: AppBuilder
:members:

.. automethod:: __init__

flask.ext.appbuilder.security.decorators
flask_appbuilder.security.decorators
========================================

.. automodule:: flask.ext.appbuilder.security.decorators
.. automodule:: flask_appbuilder.security.decorators

.. autofunction:: has_access
.. autofunction:: permission_name

flask.ext.appbuilder.models.decorators
flask_appbuilder.models.decorators
========================================

.. automodule:: flask.ext.appbuilder.models.decorators
.. automodule:: flask_appbuilder.models.decorators

.. autofunction:: renders

flask.ext.appbuilder.baseviews
flask_appbuilder.baseviews
==============================

.. automodule:: flask.ext.appbuilder.baseviews
.. automodule:: flask_appbuilder.baseviews

.. autofunction:: expose

Expand Down Expand Up @@ -61,10 +61,10 @@ BaseCRUDView
.. autoclass:: BaseCRUDView
:members:

flask.ext.appbuilder.views
flask_appbuilder.views
==========================

.. automodule:: flask.ext.appbuilder.views
.. automodule:: flask_appbuilder.views

IndexView
---------
Expand Down Expand Up @@ -108,17 +108,17 @@ CompactCRUDMixin
.. autoclass:: CompactCRUDMixin
:members:

flask.ext.appbuilder.actions
flask_appbuilder.actions
============================

.. automodule:: flask.ext.appbuilder.actions
.. automodule:: flask_appbuilder.actions

.. autofunction:: action

flask.ext.appbuilder.security
flask_appbuilder.security
=============================

.. automodule:: flask.ext.appbuilder.security.manager
.. automodule:: flask_appbuilder.security.manager

BaseSecurityManager
-------------------
Expand All @@ -129,31 +129,31 @@ BaseSecurityManager
BaseRegisterUser
----------------

.. automodule:: flask.ext.appbuilder.security.registerviews
.. automodule:: flask_appbuilder.security.registerviews

.. autoclass:: BaseRegisterUser
:members:

flask.ext.appbuilder.filemanager
flask_appbuilder.filemanager
================================

.. automodule:: flask.ext.appbuilder.filemanager
.. automodule:: flask_appbuilder.filemanager

.. autofunction:: get_file_original_name

Aggr Functions for Group By Charts
==================================

.. automodule:: flask.ext.appbuilder.models.group
.. automodule:: flask_appbuilder.models.group

.. autofunction:: aggregate_count
.. autofunction:: aggregate_avg
.. autofunction:: aggregate_sum

flask.ext.appbuilder.charts.views
flask_appbuilder.charts.views
=================================

.. automodule:: flask.ext.appbuilder.charts.views
.. automodule:: flask_appbuilder.charts.views

BaseChartView
-------------
Expand Down Expand Up @@ -192,10 +192,10 @@ GroupByChartView
:members:


flask.ext.appbuilder.models.mixins
flask_appbuilder.models.mixins
==================================

.. automodule:: flask.ext.appbuilder.models.mixins
.. automodule:: flask_appbuilder.models.mixins

.. autoclass:: BaseMixin
:members:
Expand All @@ -215,10 +215,10 @@ Extra Columns
Generic Data Source (Beta)
--------------------------

flask.ext.appbuilder.models.generic
flask_appbuilder.models.generic
===================================

.. automodule:: flask.ext.appbuilder.models.generic
.. automodule:: flask_appbuilder.models.generic

.. autoclass:: GenericColumn
:members:
Expand Down
6 changes: 3 additions & 3 deletions docs/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ So that we can use Babel to translate our index text

Define a special and simple view inherit from IndexView, don't define this view on views.py, put it on a separate file like index.py::

from flask.ext.appbuilder import IndexView
from flask_appbuilder import IndexView


class MyIndexView(IndexView):
Expand Down Expand Up @@ -214,8 +214,8 @@ All you have to do is to mix *CompactCRUDMixin* class with the *ModelView* class

::

from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask.ext.appbuilder.views import ModelView, CompactCRUDMixin
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.views import ModelView, CompactCRUDMixin
from app.models import Project, ProjectFiles
from app import appbuilder

Expand Down
2 changes: 1 addition & 1 deletion docs/generic_datasource.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ override the all method you will implement the data generation at it's heart.

On our example you must first define the **Model** you will represent::

from flask.ext.appbuilder.models.generic import GenericModel, GenericSession, GenericColumn
from flask_appbuilder.models.generic import GenericModel, GenericSession, GenericColumn

class PSModel(GenericModel):
UID = GenericColumn(str)
Expand Down
Binary file modified docs/images/contact_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/group_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/login_db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Flask-AppBuilder
================

.. module:: flask.ext.appbuilder
.. module:: flask_appbuilder

Simple and rapid application development framework, built on top of `Flask <http://flask.pocoo.org/>`_.
Includes detailed security, auto CRUD generation for your models, google charts and much more.
Expand Down
22 changes: 11 additions & 11 deletions docs/quickcharts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ we must create a function to calculate the *college_perc*::

Now we are ready to define our view::

from flask.ext.appbuilder.charts.views import DirectByChartView
from flask.ext.appbuilder.model.sqla.interface import SQLAInterface
from flask_appbuilder.charts.views import DirectByChartView
from flask_appbuilder.model.sqla.interface import SQLAInterface

class CountryDirectChartView(DirectByChartView):
datamodel = SQLAInterface(CountryStats)
Expand Down Expand Up @@ -75,8 +75,8 @@ The **definitions** property respects the following grammar::
Where 'label' and 'formatter' are optional parameters.
So on the same view you can have multiple direct chart definitions, like this::

from flask.ext.appbuilder.charts.views import DirectByChartView
from flask.ext.appbuilder.model.sqla.interface import SQLAInterface
from flask_appbuilder.charts.views import DirectByChartView
from flask_appbuilder.model.sqla.interface import SQLAInterface

class CountryDirectChartView(DirectByChartView):
datamodel = SQLAInterface(CountryStats)
Expand Down Expand Up @@ -129,7 +129,7 @@ support has many countries has we like.
The gold is to display a chart showing the unemployment
versus the percentage of the population with higher education per country::

from flask.ext.appbuilder import Model
from flask_appbuilder import Model

class Country(Model):
id = Column(Integer, primary_key=True)
Expand Down Expand Up @@ -161,9 +161,9 @@ versus the percentage of the population with higher education per country::

Now we are ready to define our view::

from flask.ext.appbuilder.charts.views import GroupByChartView
from flask.ext.appbuilder.models.group import aggregate_count, aggregate_sum, aggregate_avg
from flask.ext.appbuilder.model.sqla.interface import SQLAInterface
from flask_appbuilder.charts.views import GroupByChartView
from flask_appbuilder.models.group import aggregate_count, aggregate_sum, aggregate_avg
from flask_appbuilder.model.sqla.interface import SQLAInterface


class CountryGroupByChartView(GroupByChartView):
Expand Down Expand Up @@ -193,9 +193,9 @@ A different and interesting example is to group data monthly from all countries,
**formater** property::

import calendar
from flask.ext.appbuilder.charts.views import GroupByChartView
from flask.ext.appbuilder.models.group import aggregate_count, aggregate_sum, aggregate_avg
from flask.ext.appbuilder.model.sqla.interface import SQLAInterface
from flask_appbuilder.charts.views import GroupByChartView
from flask_appbuilder.models.group import aggregate_count, aggregate_sum, aggregate_avg
from flask_appbuilder.model.sqla.interface import SQLAInterface

def pretty_month_year(value):
return calendar.month_name[value.month] + ' ' + str(value.year)
Expand Down
8 changes: 4 additions & 4 deletions docs/quickfiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Define your model (models.py)

::

from flask.ext.appbuilder import Model
from flask.ext.appbuilder.model.mixins import ImageColumn
from flask_appbuilder import Model
from flask_appbuilder.model.mixins import ImageColumn

class Person(Model):
id = Column(Integer, primary_key=True)
Expand Down Expand Up @@ -58,8 +58,8 @@ Define your Views (views.py)

::

from flask.ext.appbuilder import ModelView
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder import ModelView
from flask_appbuilder.models.sqla.interface import SQLAInterface

class PersonModelView(ModelView):
datamodel = SQLAInterface(Person)
Expand Down
Loading

0 comments on commit 3784431

Please sign in to comment.