I have following problem:
I'm writing an AJAX view in django that serves JSON data about image list from a model that uses ImageSpecField
from django-imagekit extension:
class Image(models.Model):
title = models.CharField(max_length=120)
img = models.ImageField(upload_to="images")
thumb = ImageSpecField(source="img",
id="core:image:image_thumbnail"
)
objects = models.Manager()
json_data = JSONConvertibleManager()
The model uses custom manager for conversion into JSON (JSONConvertibleManager
) using built-in Django serializer (instance of django.core.serializers
).
My problem is that all the fields are properly serialized except for the ImageSpecField
which is getting completely ommited. Is it possible to return instance.thumb.url
value during serialization?