Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_script error in insideout mode #480

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cacheops/getset.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ def _conj_cache_key(table, conj):
for conj in disj]

def dnfs_to_schemes(cond_dnfs):
return {table: [",".join(sorted(conj)) for conj in disj]
return {table: list({",".join(sorted(conj)) for conj in disj})
for table, disj in cond_dnfs.items() if disj}
15 changes: 15 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from contextlib import contextmanager
from functools import reduce
import operator
import re
import platform
import unittest
Expand Down Expand Up @@ -718,6 +720,19 @@ def test_430_no_error_raises(self):
# no error raises on delete
media_type.delete()

def test_480(self):
orm_lookups = ['title__icontains', 'category__title__icontains', ]
search_terms = ['1', "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
queryset = Post.objects.filter(visible=True)
conditions = []
for search_term in search_terms:
queries = [
models.Q(**{orm_lookup: search_term})
for orm_lookup in orm_lookups
]
conditions.append(reduce(operator.or_, queries))
list(queryset.filter(reduce(operator.and_, conditions)).cache())


class RelatedTests(BaseTestCase):
fixtures = ['basic']
Expand Down
Loading