I want to use my django web application with RESTful services.
I have already created my models using mongoengine. Let's say I have 2 models:
class Shop(Document): name = StringField() description = StringField() address = StringField() image_path = StringField() class Item(Document): name = StringField() description = StringField() shop = ReferenceField(Shop) images = ListField(StringField())
In this scenario, I want this store to have a list of items. And when I make a request for a REST URL for the store, the store and product list must be serialized in JSON, and the response is sent to the client.
How can i do this? Which REST structure is appropriate for this case?
Should I store items in a store class? (e.g. items = (ListField (ReferenceField (Item))))
source share