Commit c359103d authored by Alex Kerney's avatar Alex Kerney

Merge commit '94a10946' into geoa-wkbelement

Conflicts:
	doc/db_geoa.rst
parents caaf7d0e 94a10946
......@@ -37,7 +37,9 @@ Creating simple model
---------------------
GeoAlchemy comes with a `Geometry`_ field that is carefully divorced from the
`Shapely`_ library. Flask-Admin will use this field so that there are no changes necessary to other code. ``ModelView`` should be imported from ``geoa`` rather than the one imported from ``sqla``::
`Shapely`_ library. Flask-Admin will use this field so that there are no
changes necessary to other code. ``ModelView`` should be imported from
``geoa`` rather than the one imported from ``sqla``::
from geoalchemy2 import Geometry
from flask.ext.admin.contrib.geoa import ModelView
......
......@@ -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