Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Integrate with dummy dashboard postgres backend

Jakub Draganekb08379ace202
diff --git a/saleor/dashboard/search/forms.py b/saleor/dashboard/search/forms.py
index 7249cffc0c..a4622bc8eb 100644
--- a/saleor/dashboard/search/forms.py
+++ b/saleor/dashboard/search/forms.py
@@ -1,10 +1,11 @@
from __future__ import unicode_literals
-from ...search.backends import elasticsearch_dashboard
+from ...search.backends import picker
from ...search.forms import SearchForm
class DashboardSearchForm(SearchForm):
def search(self):
query = self.cleaned_data['q']
- return elasticsearch_dashboard.search(query)
+ search = picker.pick_dashboard_backend()
+ return search(query)
diff --git a/saleor/search/backends/postgresql_dashboard.py b/saleor/search/backends/postgresql_dashboard.py
index e11b196206..dce87f2595 100644
--- a/saleor/search/backends/postgresql_dashboard.py
+++ b/saleor/search/backends/postgresql_dashboard.py
@@ -1,2 +1,9 @@
+from ...product.models import Product
+from ...order.models import Order
+from ...userprofile.models import User
+
+
def search(phrase):
- pass
+ return {'products': Product.objects.none(),
+ 'orders': Order.objects.none(),
+ 'users': User.objects.none()}
diff --git a/tests/test_postgresql_search.py b/tests/test_postgresql_search.py
index 674121d4fd..f58e8539f5 100644
--- a/tests/test_postgresql_search.py
+++ b/tests/test_postgresql_search.py
@@ -15,3 +15,9 @@ def postgresql_search_enabled(settings):
def test_dummy_integration(client):
phrase = 'foo'
client.get(reverse('search:search'), {'q': phrase})
+
+
+def test_dummy_dashboard_integration(client):
+ phrase = 'foo'
+ client.get(reverse('dashboard:search'), {'q': phrase})