Skip to content

Instantly share code, notes, and snippets.

@hughes
Created September 18, 2012 20:30
Show Gist options
  • Save hughes/3745668 to your computer and use it in GitHub Desktop.
Save hughes/3745668 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment