Commit b31f116d authored by Serge S. Koval's avatar Serge S. Koval

Merge pull request #647 from asmundg/x-outerjoin-searches

Outerjoin searches
parents e16b6617 b11f77a5
......@@ -741,8 +741,8 @@ class ModelView(BaseModelView):
# Apply search-related joins
if self._search_joins:
for table in self._search_joins:
query = query.join(table)
count_query = count_query.join(table)
query = query.outerjoin(table)
count_query = count_query.outerjoin(table)
joins.add(table.name)
......
......@@ -246,6 +246,26 @@ def test_complex_searchable_list():
ok_('model3' not in data)
def test_complex_searchable_list_missing_children():
app, db, admin = setup()
Model1, Model2 = create_models(db)
view = CustomModelView(Model1, db.session,
column_searchable_list=[
'test1', 'model2.string_field'])
admin.add_view(view)
db.session.add(Model1('magic string'))
db.session.commit()
client = app.test_client()
rv = client.get('/admin/model1/?search=magic')
data = rv.data.decode('utf-8')
ok_('magic string' in data)
def test_column_filters():
app, db, admin = setup()
......
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