podjango: Use or_ instead of lambda
				
					
				
			Easier to read.
This commit is contained in:
		
							parent
							
								
									e7f21fa253
								
							
						
					
					
						commit
						ffa2889acb
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -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): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue