Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, I found my own answer. In EventInviteesResource</p> <pre><code>user = fields.ForeignKey(UserResource, 'invitee', full=True) </code></pre> <p>Needs to be the following in order to mirror my Django Model:</p> <pre><code>invitee = fields.ForeignKey(UserResource, 'invitee', full=True) </code></pre> <p>While this DOES seem logical, I must say that the "invitees" (notice the "s") error I was getting does NOT but oh well...</p> <p>Bonus Answer, in EventResource, update:</p> <pre><code>invitees = fields.ToManyField('bbservices.api.EventInviteesResource', 'invitees', full=True) </code></pre> <p>To:</p> <pre><code>invitees = fields.ToManyField('bbservices.api.EventInviteesResource', 'invitees', related_name='event', full=True) </code></pre> <p>An now you can post to EventResource with invitees and have those created automatically as well. The post data would look like this:</p> <pre><code>{ "store" : "/api/v1/store/2/", "name" : "Yes again?", "event_time" : "2013-02-06T18:30-3:00", "requires_confirmation" : true, "invitees" : [ { "invitee" : "/api/v1/user/1/", "confirmed" : true } ] } </code></pre> <p>So now my only doubt is...can anyone tell me why I cant use the PK syntax for FKs:</p> <pre><code>{ "store" : {"pk" : 2}, ... </code></pre> <p>This results in errors stating that fields for the Store object cannot be null as if it was try to create a new store object. If I use the URI path as below it works fine:</p> <pre><code>{ "store" : "/api/v1/store/2/", ... </code></pre> <p>But I would prefer not to have to pass back the full URI and I should have to. That is why I'm using the store_id trick in obj_create but its VERY kludgy...</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload