django-searchkit 1.1__tar.gz → 1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_searchkit-1.1/django_searchkit.egg-info → django_searchkit-1.2}/PKG-INFO +1 -1
- {django_searchkit-1.1 → django_searchkit-1.2/django_searchkit.egg-info}/PKG-INFO +1 -1
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/__version__.py +1 -1
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/filters.py +5 -4
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/models.py +0 -6
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/tests.py +0 -2
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/views.py +3 -3
- {django_searchkit-1.1 → django_searchkit-1.2}/LICENCE +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/MANIFEST.in +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/README.md +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/SOURCES.txt +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/dependency_links.txt +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/requires.txt +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/top_level.txt +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/zip-safe +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/admin.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/asgi.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/management/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/management/commands/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/management/commands/createtestdata.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/migrations/0001_initial.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/migrations/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/models.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/settings.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/urls.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/example/example/wsgi.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/admin.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/apps.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/forms/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/forms/fields.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/forms/search.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/forms/searchkit.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/forms/utils.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/migrations/0001_initial.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/migrations/0002_rename_searchkitsearch_search.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/migrations/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/templatetags/__init__.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/templatetags/searchkit.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/searchkit/urls.py +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/setup.cfg +0 -0
- {django_searchkit-1.1 → django_searchkit-1.2}/setup.py +0 -0
@@ -14,14 +14,15 @@ class SearchkitFilter(SimpleListFilter):
|
|
14
14
|
self.searchkit_model = ContentType.objects.get_for_model(model)
|
15
15
|
super().__init__(request, params, model, model_admin)
|
16
16
|
|
17
|
+
def has_output(self):
|
18
|
+
return True
|
19
|
+
|
17
20
|
def lookups(self, request, model_admin):
|
18
|
-
|
19
|
-
# choices.
|
20
|
-
searches = Search.objects.filter(contenttype=self.searchkit_model).order_by('-created_date')[:3]
|
21
|
+
searches = Search.objects.filter(contenttype=self.searchkit_model).order_by('-created_date')
|
21
22
|
return [(str(obj.id), obj.name) for obj in searches]
|
22
23
|
|
23
24
|
def queryset(self, request, queryset):
|
24
25
|
# Filter the queryset based on the selected SearchkitSearch object
|
25
26
|
if self.value():
|
26
27
|
search = Search.objects.get(id=int(self.value()))
|
27
|
-
return search.
|
28
|
+
return queryset.filter(**search.as_lookups())
|
@@ -19,9 +19,3 @@ class Search(models.Model):
|
|
19
19
|
for data in self.data:
|
20
20
|
lookups[f'{data["field"]}__{data["operator"]}'] = data['value']
|
21
21
|
return lookups
|
22
|
-
|
23
|
-
def as_queryset(self):
|
24
|
-
"""
|
25
|
-
Returns a filtered queryset for the model.
|
26
|
-
"""
|
27
|
-
return self.contenttype.model_class().objects.filter(**self.as_lookups())
|
@@ -263,8 +263,6 @@ class SearchkitSearchFormTestCase(TestCase):
|
|
263
263
|
self.assertEqual(len(filter_rules), len(INITIAL_DATA))
|
264
264
|
for data in INITIAL_DATA:
|
265
265
|
self.assertIn(f"{data['field']}__{data['operator']}", filter_rules)
|
266
|
-
queryset = form.instance.as_queryset()
|
267
|
-
self.assertTrue(queryset.model == ModelA)
|
268
266
|
|
269
267
|
|
270
268
|
class SearchkitModelFormTestCase(TestCase):
|
@@ -14,9 +14,9 @@ class SearchkitAjaxView(View):
|
|
14
14
|
Reload the formset via ajax.
|
15
15
|
"""
|
16
16
|
def get(self, request, **kwargs):
|
17
|
-
|
18
|
-
if
|
19
|
-
model =
|
17
|
+
model_form = SearchkitModelForm(data=self.request.GET)
|
18
|
+
if model_form.is_valid():
|
19
|
+
model = model_form.cleaned_data['searchkit_model'].model_class()
|
20
20
|
formset = searchkit_formset_factory(model=model)(data=request.GET)
|
21
21
|
return HttpResponse(formset.render())
|
22
22
|
else:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{django_searchkit-1.1 → django_searchkit-1.2}/django_searchkit.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{django_searchkit-1.1 → django_searchkit-1.2}/example/example/management/commands/__init__.py
RENAMED
File without changes
|
{django_searchkit-1.1 → django_searchkit-1.2}/example/example/management/commands/createtestdata.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|