Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Hughes hughes

View GitHub Profile
View gist:3745668
def dehydrate_images(self, bundle):
images = OfferImage.objects.filter(offer=bundle.obj.pk)
resource = OfferImageResource()
result = []
for image in images:
bundle = resource.build_bundle(obj=image, request=bundle.request)
data = resource.full_dehydrate(bundle).data
data["resource_uri"] = resource.get_resource_uri(image)
result.append(data)
return result