django rest_framework works very well if the datas You would like to expose are coming from the database, but what' s the situation if the datas are coming from simply a list (of dictionaries)? Is there any support in rest_framework to represent datas like this?:
[
{'id': 1, 'name': 'apple'},
{'id': 2, 'name', 'banana'},
{'id': 3, 'name': 'orange'},
]
.
What would be the best way to achieve my goal if it' s sure the datas will never change (so no need to put them into the db as we' re talking about only less than 10 elements)?
I guess to convert the list to a fake QuerySet in django 1.6+ is not possible anymore... .
Rest_framework version: 3.1.1 Django version: 1.7.x
.
Aucun commentaire:
Enregistrer un commentaire