File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 11# coding: utf-8
22
3- from math import isnan
43from django .core .cache import cache
54from django .utils .encoding import force_text
65
@@ -32,7 +31,7 @@ def replace_pk(model):
3231 base_cache_key = get_base_cache_key (model )
3332
3433 def inner (pk_list ):
35- cache_keys = [None if isnan ( pk ) else base_cache_key % pk
34+ cache_keys = [None if pk is None else base_cache_key % pk
3635 for pk in pk_list ]
3736 out_dict = cache .get_many (frozenset (cache_keys ))
3837 try :
@@ -42,7 +41,7 @@ def inner(pk_list):
4241 out_dict = {
4342 base_cache_key % obj .pk : force_text (obj )
4443 for obj in model .objects .filter (pk__in = {pk for pk in pk_list
45- if not isnan ( pk ) })}
44+ if pk is not None })}
4645 cache .set_many (out_dict )
4746 out_list = map (out_dict .get , cache_keys )
4847 return out_list
You can’t perform that action at this time.
0 commit comments