1
0
mirror of https://github.com/TandoorRecipes/recipes.git synced 2026-01-11 09:07:12 -05:00

filter distinct on some queries with shared models

This commit is contained in:
vabene1111
2021-09-08 15:58:27 +02:00
parent 04c047bd31
commit 2df8ed8e80
3 changed files with 17 additions and 12 deletions

View File

@@ -604,7 +604,12 @@ def offline(request):
def test(request):
if not settings.DEBUG:
return HttpResponseRedirect(reverse('index'))
return JsonResponse(parse('Pane (raffermo o secco) 80 g'), safe=False)
with scopes_disabled():
result = ShoppingList.objects.filter(
Q(created_by=request.user) | Q(shared=request.user)).filter(
space=request.space).values().distinct()
return JsonResponse(list(result), safe=False, json_dumps_params={'indent': 2})
def test2(request):