From ffa2889acb73364428bba595e3f0b8597bc4e1ef Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Fri, 23 Feb 2024 15:00:42 +1100 Subject: [PATCH] podjango: Use `or_` instead of lambda Easier to read. --- conservancy/podjango/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conservancy/podjango/views.py b/conservancy/podjango/views.py index 359ce810..28e7ffa9 100644 --- a/conservancy/podjango/views.py +++ b/conservancy/podjango/views.py @@ -18,6 +18,7 @@ # from datetime import datetime from functools import reduce +from operator import or_ from django.shortcuts import get_object_or_404, render from django.views.generic.list import ListView @@ -27,7 +28,7 @@ from .models import Cast, CastTag def OR_filter(field_name, objs): from django.db.models import Q - return reduce(lambda x, y: x | y, + return reduce(or_, [Q(**{field_name: x.id}) for x in objs]) def last_name(person):