Unable to post boolean to nested field
I have a OneToOne field to the user and a boolean: https://git.startinblox.com/djangoldp-packages/djangoldp-notification/blob/master/djangoldp_notification/models.py#L58-60
I want to change this boolean.
When I post directly to /settings/xyz/
, it works fine.
When I post to /users/xyz/
, {settings: {"@id": "/settings/xyz/, "receiveMail": false}}
, it does not work.
With other kind of fields, like on djangoldp-profiles
, it works fine.
Related jsbin: https://jsbin.com/luneleveva/1/edit?html,output
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Jean-Baptiste Pasquier added BUG label
added BUG label
- Author Owner
@calummackervoy Could you have a look please?
Collapse replies - Maintainer
What's the error you receive? In the JSBin I get
Authentication credentials were not provided.
even though I'm logged into the test3 with the same account I've put into the form - Author Owner
I got no error, the first one works fine, second does return my user but didn't set the receiveMail to true/false.
Did you changed your username & the settings route on the jsbin to yours?
Edited by Jean-Baptiste Pasquier - Maintainer
Did you changed your username & the settings route on the jsbin to yours?
I did yeah, but I've replicated this in a unit test anyway so I'll follow that track :)
Edited by Calum Mackervoy - Maintainer
Could I see a log of the request sent to the server please?
My failing test was due to the
JSONLDParser
trimming the non-RDF field e.g.Fails:
{ 'settings': ... }
Passes:
{ 'http://happy-dev.fr/owl/#settings': ... }
Edited by Calum Mackervoy - Author Owner
{"settings":{"receiveMail":true,"@id":"https://api.test3.startinblox.com/settings/8/"},"username":"jbpasquier","email":"contact@jbpasquier.eu","@id":"https://api.test3.startinblox.com/users/jbpasquier/","@context":{"@vocab":"http://happy-dev.fr/owl/#","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","ldp":"http://www.w3.org/ns/ldp#","foaf":"http://xmlns.com/foaf/0.1/","name":"rdfs:label","acl":"http://www.w3.org/ns/auth/acl#","permissions":"acl:accessControl","mode":"acl:mode","geo":"http://www.w3.org/2003/01/geo/wgs84_pos#","lat":"geo:lat","lng":"geo:long"}}
- Maintainer
Based on my test results, I think that
receiveMail
is defined in the@context
/ontology, butsettings
isn't?For example, these pass:
direct
{ 'http://happy-dev.fr/owl/#@id': setting.urlid, 'http://happy-dev.fr/owl/#receiveMail': True }
indirect
{ 'http://happy-dev.fr/owl/#settings': { 'http://happy-dev.fr/owl/#@id': setting.urlid, 'http://happy-dev.fr/owl/#receiveMail': True } }
and these both fail (in the way you described):
direct
{ 'http://happy-dev.fr/owl/#@id': setting.urlid, 'receiveMail': True }
indirect
{ 'settings': { 'http://happy-dev.fr/owl/#@id': setting.urlid, 'http://happy-dev.fr/owl/#receiveMail': True } }
(I'm not passing any additional context in the request)
Edited by Calum Mackervoy - Maintainer
It possibly shouldn't be failing silently (and should return
400
), but this is the behaviour of PyLD - Author Owner
Neither are defined in the context?
- Maintainer
I meant in
http://happy-dev.fr/owl/#
, but running my test with the@vocab
set.. everything passes :S - Author Owner
You mean that posting this on test3 works?
Target: https://api.test3.startinblox.com/users/calum3/
{"settings":{"receiveMail":true,"@id":"https://api.test3.startinblox.com/settings/2/"},"username":"calum3","email":"calum@startinblox.com","@id":"https://api.test3.startinblox.com/users/calum3/","@context":{"@vocab":"http://happy-dev.fr/owl/#","rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdfs":"http://www.w3.org/2000/01/rdf-schema#","ldp":"http://www.w3.org/ns/ldp#","foaf":"http://xmlns.com/foaf/0.1/","name":"rdfs:label","acl":"http://www.w3.org/ns/auth/acl#","permissions":"acl:accessControl","mode":"acl:mode","geo":"http://www.w3.org/2003/01/geo/wgs84_pos#","lat":"geo:lat","lng":"geo:long"}}
- Maintainer
My test was wrong
MR open here: !186 (merged)
- Jean-Baptiste Pasquier mentioned in issue applications/hubl#669 (closed)
mentioned in issue applications/hubl#669 (closed)
- Benoit Alessandroni added P1 label
added P1 label
- Calum Mackervoy mentioned in merge request !186 (merged)
mentioned in merge request !186 (merged)
- Jean-Baptiste Pasquier closed via merge request !186 (merged)
closed via merge request !186 (merged)
- Jean-Baptiste Pasquier mentioned in commit 62e903e6
mentioned in commit 62e903e6