Last active
December 18, 2015 16:08
-
-
Save noisy/3bb668b3c39ed7f698ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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