Commit 94a10946 authored by Alex Kerney's avatar Alex Kerney

Merge pull request #1 from mrjoes/master

Up to date
parents f5748f25 58789da1
......@@ -45,6 +45,7 @@ use this field rather that the one that ships with GeoAlchemy when defining your
models::
from flask.ext.admin.contrib.geoa.sqltypes import Geometry
from flask.ext.admin.contrib.geoa import ModelView
# .. flask initialization
db = SQLAlchemy(app)
......@@ -61,6 +62,9 @@ models::
db.create_all()
app.run('0.0.0.0', 8000)
Note that you also have to use the ``ModelView`` class imported from ``geoa``,
rather than the one imported from ``sqla``.
Limitations
-----------
......
......@@ -586,6 +586,14 @@ class ModelView(BaseModelView):
"""
return isinstance(filter, filters.BaseSQLAFilter)
def handle_filter(self, filter):
column = filter.column
if self._need_join(column.table):
self._filter_joins[column.table.name] = [column.table]
return filter
def scaffold_form(self):
"""
Create form from the model.
......
......@@ -773,6 +773,15 @@ class BaseModelView(BaseView, ActionsMixin):
"""
return isinstance(filter, filters.BaseFilter)
def handle_filter(self, filter):
"""
Postprocess (add joins, etc) for a filter.
:param filter:
Filter object to postprocess
"""
return filter
def get_filters(self):
"""
Return a list of filter objects.
......@@ -785,7 +794,7 @@ class BaseModelView(BaseView, ActionsMixin):
for n in self.column_filters:
if self.is_valid_filter(n):
collection.append(n)
collection.append(self.handle_filter(n))
else:
flt = self.scaffold_filters(n)
if flt:
......
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