Skip to content

Instantly share code, notes, and snippets.

View hughes's full-sized avatar

Matt Hughes hughes

View GitHub Profile
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