Commit 2df9b610 authored by Serge S. Koval's avatar Serge S. Koval

Renamed admin.ext to admin.contrib

parent 971bea12
``flask.ext.admin.ext.fileadmin`` ``flask.ext.admin.contrib.fileadmin``
================================= =====================================
.. automodule:: flask.ext.admin.ext.fileadmin .. automodule:: flask.ext.admin.contrib.fileadmin
.. autoclass:: FileAdmin .. autoclass:: FileAdmin
:members: :members:
......
``flask.ext.admin.ext.sqlamodel`` ``flask.ext.admin.contrib.sqlamodel``
================================= =====================================
.. automodule:: flask.ext.admin.ext.sqlamodel .. automodule:: flask.ext.admin.contrib.sqlamodel
.. autoclass:: ModelView .. autoclass:: ModelView
:members: :members:
......
Adding new model backend Adding new model backend
======================== ========================
If you want to implement new database backend to use with model views, follow steps from this guideline. If you want to implement new database backend to use with model views, follow steps found in this guideline.
There are few assumptions about models: There are few assumptions about models:
1. Model has "primary key" - value which uniquely identifies 1. Model has "primary key" - value which uniquely identifies
one model in a data store. There's no restriction on the one model in a data store. There's no restriction on the
data type. data type or field name.
2. Model has readable python properties 2. Model has readable python properties
3. It is possible to get list of models (optionally - sorted, 3. It is possible to get list of models (optionally - sorted,
filtered, etc) from data store filtered, etc) from data store
...@@ -30,7 +30,7 @@ Steps to add new model backend: ...@@ -30,7 +30,7 @@ Steps to add new model backend:
This method will return primary key value from This method will return primary key value from
the model. For example, in SQLAlchemy backend, the model. For example, in SQLAlchemy backend,
it gets primary key from the model (:meth:`~flask.ext.admin.ext.sqla.ModelView.scaffold_pk), caches it it gets primary key from the model (:meth:`~flask.ext.admin.contrib.sqla.ModelView.scaffold_pk), caches it
and returns actual value from the model from ``get_pk_value`` when requested. and returns actual value from the model from ``get_pk_value`` when requested.
For example:: For example::
...@@ -103,7 +103,7 @@ Steps to add new model backend: ...@@ -103,7 +103,7 @@ Steps to add new model backend:
filtering logic for this filter type. filtering logic for this filter type.
Lets take SQLAlchemy model backend as an example. Lets take SQLAlchemy model backend as an example.
All SQLAlchemy filters derive from :class:`~flask.ext.admin.ext.sqla.filters.BaseSQLAFilter` class. All SQLAlchemy filters derive from :class:`~flask.ext.admin.contrib.sqla.filters.BaseSQLAFilter` class.
Each filter implements one simple filter SQL operation Each filter implements one simple filter SQL operation
(like, not like, greater, etc) and accepts column as (like, not like, greater, etc) and accepts column as
......
...@@ -196,7 +196,7 @@ Model Views ...@@ -196,7 +196,7 @@ Model Views
Flask-Admin comes with built-in SQLAlchemy model administrative interface. It is very easy to use:: Flask-Admin comes with built-in SQLAlchemy model administrative interface. It is very easy to use::
from flask.ext.admin.ext.sqlamodel import ModelView from flask.ext.admin.contrib.sqlamodel import ModelView
from flask.ext.sqlalchemy import db from flask.ext.sqlalchemy import db
# Flask and Flask-SQLAlchemy initialization here # Flask and Flask-SQLAlchemy initialization here
...@@ -236,7 +236,7 @@ you can do something like this:: ...@@ -236,7 +236,7 @@ you can do something like this::
It is very easy to add support for different database backends (Mongo, etc) by inheriting from `BaseModelView` It is very easy to add support for different database backends (Mongo, etc) by inheriting from `BaseModelView`
class and implementing database-related methods. class and implementing database-related methods.
Please refer to :mod:`flask.ext.admin.ext.sqlamodel` documentation on how to customize behavior of model-based administrative views. Please refer to :mod:`flask.ext.admin.contrib.sqlamodel` documentation on how to customize behavior of model-based administrative views.
File Admin File Admin
---------- ----------
...@@ -245,7 +245,7 @@ Flask-Admin comes with another handy battery - file admin. It gives you ability ...@@ -245,7 +245,7 @@ Flask-Admin comes with another handy battery - file admin. It gives you ability
Here is simple example:: Here is simple example::
from flask.ext.admin.ext.fileadmin import FileAdmin from flask.ext.admin.contrib.fileadmin import FileAdmin
import os.path as op import os.path as op
...@@ -263,7 +263,7 @@ Sample screenshot: ...@@ -263,7 +263,7 @@ Sample screenshot:
:target: ../_images/quickstart_5.png :target: ../_images/quickstart_5.png
You can disable uploads, disable file or directory deletion, restrict file uploads to certain types and so on. You can disable uploads, disable file or directory deletion, restrict file uploads to certain types and so on.
Check :mod:`flask.ext.admin.ext.fileadmin` documentation on how to do it. Check :mod:`flask.ext.admin.contrib.fileadmin` documentation on how to do it.
Examples Examples
-------- --------
......
...@@ -2,7 +2,7 @@ from flask import Flask, url_for, redirect, render_template, request ...@@ -2,7 +2,7 @@ from flask import Flask, url_for, redirect, render_template, request
from flaskext.sqlalchemy import SQLAlchemy from flaskext.sqlalchemy import SQLAlchemy
from flask.ext import admin, login, wtf from flask.ext import admin, login, wtf
from flask.ext.admin.ext import sqlamodel from flask.ext.admin.contrib import sqlamodel
# Create application # Create application
app = Flask(__name__) app = Flask(__name__)
......
...@@ -4,7 +4,7 @@ from flaskext.sqlalchemy import SQLAlchemy ...@@ -4,7 +4,7 @@ from flaskext.sqlalchemy import SQLAlchemy
from flask.ext import admin from flask.ext import admin
from flask.ext.babel import Babel from flask.ext.babel import Babel
from flask.ext.admin.ext import sqlamodel from flask.ext.admin.contrib import sqlamodel
# Create application # Create application
app = Flask(__name__) app = Flask(__name__)
......
...@@ -4,7 +4,7 @@ import os.path as op ...@@ -4,7 +4,7 @@ import os.path as op
from flask import Flask from flask import Flask
from flask.ext import admin from flask.ext import admin
from flask.ext.admin.ext import fileadmin from flask.ext.admin.contrib import fileadmin
# Create flask app # Create flask app
......
...@@ -2,8 +2,8 @@ from flask import Flask ...@@ -2,8 +2,8 @@ from flask import Flask
from flaskext.sqlalchemy import SQLAlchemy from flaskext.sqlalchemy import SQLAlchemy
from flask.ext import admin, wtf from flask.ext import admin, wtf
from flask.ext.admin.ext import sqlamodel from flask.ext.admin.contrib import sqlamodel
from flask.ext.admin.ext.sqlamodel import filters from flask.ext.admin.contrib.sqlamodel import filters
# Create application # Create application
app = Flask(__name__) app = Flask(__name__)
......
...@@ -10,7 +10,7 @@ from flask.ext.babel import gettext ...@@ -10,7 +10,7 @@ from flask.ext.babel import gettext
from flask.ext.admin.form import BaseForm from flask.ext.admin.form import BaseForm
from flask.ext.admin.model import BaseModelView from flask.ext.admin.model import BaseModelView
from flask.ext.admin.ext.sqlamodel import form, filters, tools from flask.ext.admin.contrib.sqlamodel import form, filters, tools
class ModelView(BaseModelView): class ModelView(BaseModelView):
...@@ -93,7 +93,7 @@ class ModelView(BaseModelView): ...@@ -93,7 +93,7 @@ class ModelView(BaseModelView):
""" """
Collection of the column filters. Collection of the column filters.
Can contain either field names or instances of :class:`flask.ext.admin.ext.sqlamodel.filters.BaseFilter` classes. Can contain either field names or instances of :class:`flask.ext.admin.contrib.sqlamodel.filters.BaseFilter` classes.
For example:: For example::
......
...@@ -119,7 +119,7 @@ def convert(*args): ...@@ -119,7 +119,7 @@ def convert(*args):
""" """
Decorator for field to filter conversion routine. Decorator for field to filter conversion routine.
See :mod:`flask.ext.admin.ext.sqlamodel.filters` for usage example. See :mod:`flask.ext.admin.contrib.sqlamodel.filters` for usage example.
""" """
def _inner(func): def _inner(func):
func._converter_for = args func._converter_for = args
......
...@@ -6,7 +6,7 @@ from flask.ext import wtf ...@@ -6,7 +6,7 @@ from flask.ext import wtf
from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin import Admin from flask.ext.admin import Admin
from flask.ext.admin.ext.sqlamodel import ModelView from flask.ext.admin.contrib.sqlamodel import ModelView
class CustomModelView(ModelView): class CustomModelView(ModelView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment