Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add FileField caching support playfire#4

  • Loading branch information...
commit 458458dfda4621dbdeec81534c3c95e0d883d564 1 parent ff86e5f
@icohen icohen authored lamby committed
Showing with 6 additions and 4 deletions.
  1. +6 −4 cache_toolbox/core.py
View
10 cache_toolbox/core.py
@@ -68,10 +68,12 @@ def get_instance(model, instance_or_pk, timeout=None, using=None):
continue
if field.get_internal_type() == 'FileField':
- # Prevent problems with DNImageField by not serialising it.
- continue
-
- data[field.attname] = getattr(instance, field.attname)
+ # Avoid problems with serializing FileFields
+ # by only serializing the file name
+ file = getattr(instance, field.attname)
+ data[field.attname] = file.name
+ else:
+ data[field.attname] = getattr(instance, field.attname)
if timeout is None:
timeout = app_settings.CACHE_TOOLBOX_DEFAULT_TIMEOUT
Please sign in to comment.
Something went wrong with that request. Please try again.