Skip to content

Instantly share code, notes, and snippets.

@noisy
Last active December 18, 2015 16:08
Show Gist options
  • Save noisy/3bb668b3c39ed7f698ca to your computer and use it in GitHub Desktop.
Save noisy/3bb668b3c39ed7f698ca to your computer and use it in GitHub Desktop.
class ProductView(View):
MOCKED_DATA = {
'height': 250,
'width': 150,
'img': 'http://lorempixel.com/150/250/'
}
# ...
def prepare_response(self):
response = []
for product in Product.objects.all():
product_dict = {
'data': self.MOCKED_DATA,
'meta': {}
}
product_dict['data'].update(product.to_dict())
response.append(product_dict)
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment