lundi 26 septembre 2016

Ember serializer customization for alternate url

I am a newbie to ember. So here is what i faced. I got backend RESTAPI written in python/Django. It provides following json response on /api/works/

[
{
    "id": 17,
    "title": "about us",
    "description": "some project",
    "owner": "admin"
},
{
    "id": 19,
    "title": "test1 profit project",
    "description": "dev null",
    "owner": "test1"
}
]

also on detail view E.g:/api/works/17/:

{
"id": 17,
"title": "about us",
"description": "some project",
"owner": "admin"
}

there is also /api/works/17/tasks/ for listing work tasks

[
{
    "id": 2,
    "title": "secondWorkTask",
    "description": "task2 description",
    "due_date": "2016-09-26",
    "assign": 1,
    "project": "about us"
},
{
    "id": 3,
    "title": "some task name",
    "description": "some task description",
    "due_date": "2016-08-27",
    "assign": 2,
    "project": "about us"
}
]

on the front-end side i am using ember-cli version2.7.0 + ember-django-adapter. I can get /api/works without problem. What i want to achieve is on the ember side when work detail url load, it must show all tasks. Currently i can get work detail by this url /api/works/17/ But how can i get tasks? Please help me to find a way to solve this.




Aucun commentaire:

Enregistrer un commentaire