You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current implementation was a bit of a cop out: listing jobs will return the id instead of values for objects with many to many relationships. For example, look at the values for sites and labels:
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 4,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"title": "Reading Support Person",
"text": "Volunteer will work either one-on-one or in a small group - no more than 4 - to help students increase reading mileage an d comprehension. Students often need help in developing vocabulary and reading strategies for unknown words. We have a hig h number of English language learners (ELL) and they benefit from having support in this area",
"labels": [
5
],
"organisation": {
"id": 1,
"name": "Volunteer Wellington",
"region": "wellington",
"city": "wellington",
"url": "https://www.volunteerwellington.org.nz/",
"created_at": "2017-10-08T22:36:24.078728Z",
"updated_at": "2017-10-08T22:36:24.103673Z"
},
"sites": [
1
],
"country": "new zealand",
"region": "wellington",
"created_at": "2017-10-08T22:36:23.965767Z",
"updated_at": "2017-10-08T22:36:24.030438Z",
"url": "https://seekvolunteer.co.nz/volunteering/49932/reading-support-person",
"seen": 0
},
{
"id": 2,
"title": "Gardener",
"text": "Basic gardening to ensure vegetable gardens remain weeded fertilised and watered in the spring and summer growing seasons . Every August we have a team of volunteers come in and prepare the gardens for spring but the gardens need ongoing mainte nance to ensure they are as productive as possible. Ideal role for a Karori local to come once or twice a week to maintain and water garden and ensure planting happens at right times for Karori climate but anyone keen is welcome",
"labels": [
4
],
"organisation": {
"id": 1,
"name": "Volunteer Wellington",
"region": "wellington",
"city": "wellington",
"url": "https://www.volunteerwellington.org.nz/",
"created_at": "2017-10-08T22:36:24.078728Z",
"updated_at": "2017-10-08T22:36:24.103673Z"
},
"sites": [
1
],
"country": "new zealand",
"region": "wellington",
"created_at": "2017-10-08T22:36:23.965767Z",
"updated_at": "2017-10-08T22:36:24.030438Z",
"url": "https://seekvolunteer.co.nz/volunteering/49914/gardener",
"seen": 0
},
{
"id": 3,
"title": "Companion Volunteer",
"text": "Provide safe companionship and support to the person with dementia for 1-2 hours weekly or fortnightly. This may include (but is not limited to) tasks such as visiting a cafe or library, going for a walk, making a cup of tea, reading the newsp aper together, watching sport etc. Police check required. TRAINING: Initial induction of two 2-hour sessions and ongoing o ptional training throughout the year. How to Apply",
"labels": [
5
],
"organisation": {
"id": 2,
"name": "Dementia Canterbury",
"region": "canterbury",
"city": "christchurch",
"url": "https://www.dementiacanterbury.org.nz/",
"created_at": "2017-10-08T22:36:24.078728Z",
"updated_at": "2017-10-08T22:36:24.103673Z"
},
"sites": [
2
],
"country": "new zealand",
"region": "wellington",
"created_at": "2017-10-08T22:36:23.965767Z",
"updated_at": "2017-10-08T22:36:24.030438Z",
"url": "https://dogoodjobs.co.nz/jobs/companion-volunteer",
"seen": 0
},
{
"id": 4,
"title": "Nappy changer",
"text": "This is a great opportunity for young and old",
"labels": [
5
],
"organisation": {
"id": 1,
"name": "Volunteer Wellington",
"region": "wellington",
"city": "wellington",
"url": "https://www.volunteerwellington.org.nz/",
"created_at": "2017-10-08T22:36:24.078728Z",
"updated_at": "2017-10-08T22:36:24.103673Z"
},
"sites": [
2
],
"country": "new zealand",
"region": "otago",
"created_at": "2017-10-08T22:36:23.965767Z",
"updated_at": "2017-10-08T22:36:24.030438Z",
"url": "https://dogoodjobs.co.nz/nappy-changer",
"seen": 0
}
]
}
This was an easy way of getting the API working with many2many relationships for both getting and creating nested structures like the Job model.
DoD:
Getting items from the jobs endpoints will expend nested models Labels and Sites will expand them, when updating job.
Creating or updating Jobs allows either passing in the id, or passing in the nested structure.
Current implementation was a bit of a cop out: listing jobs will return the id instead of values for objects with many to many relationships. For example, look at the values for
sites
andlabels
:This was an easy way of getting the API working with many2many relationships for both getting and creating nested structures like the
Job
model.DoD:
Labels
andSites
will expand them, when updating job.See:
The text was updated successfully, but these errors were encountered: