1👍
Just from playing around with it very, very quickly (and I’m new to tastypie so take this with a grain of salt) – I think you can do this by overriding the obj_create() method inside your resource. Something like this:
class SomeResource(ModelResource):
class Meta:
# yadda yadda
def obj_create(self, bundle, request, **kwargs):
print "hey we're in object create"
# do something with bundle.data, this will have your songs in it
return super(SomeResource, self).obj_create(bundle, request, **kwargs)
0👍
You want to do something like this:
curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"name":"playlist_name", "field2":"value2", "song": ["/api/v1/song/1/"]}' http://localhost:8000/api/v1/playlist/
Good luck!
👤Erik
- [Answer]-Why doesn't Django recognize my installed package?
- [Answer]-Use AFNetworking to download a file from Django server
- [Answer]-How can I add an anchor to a URL when it has no anchors?
- [Answer]-Error message displaying, giving problems with user login Django 1.6
- [Answer]-Django: Jquery click function not working in Ajax
Source:stackexchange.com