File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11# coding: utf-8
22
3+ from math import isnan
34from django .core .cache import cache
45from django .utils .encoding import force_text
56
@@ -31,7 +32,7 @@ def replace_pk(model):
3132 base_cache_key = get_base_cache_key (model )
3233
3334 def inner (pk_list ):
34- cache_keys = [None if pk is None else base_cache_key % pk
35+ cache_keys = [None if isnan ( pk ) else base_cache_key % pk
3536 for pk in pk_list ]
3637 out_dict = cache .get_many (frozenset (cache_keys ))
3738 try :
@@ -41,7 +42,7 @@ def inner(pk_list):
4142 out_dict = {
4243 base_cache_key % obj .pk : force_text (obj )
4344 for obj in model .objects .filter (pk__in = {pk for pk in pk_list
44- if pk is not None })}
45+ if not isnan ( pk ) })}
4546 cache .set_many (out_dict )
4647 out_list = list (map (out_dict .get , cache_keys ))
4748 return out_list
You can’t perform that action at this time.
0 commit comments