Closed leo-naeka closed 12 years ago
Can you please prepare a test case with this problem? And make a pull request? Test case should populate data through RESTful API, not directly in the database.
Uh, nested lists? This was never meant to be supported. This is a feature request.
Are you sure it is needed? For me it looks a bit strange to have a board with list of posts. So everytime you will want to read one post you will load the whole board? In nonrel databases you should optimize to the most common use. Probably the most common use is to display posts. So post should be a document. And board could just be a field to limit the posts to.
Or was this just an example for test?
Yes, of course, that was just for testing, to be clear with a common example, and... I wasn't so much inspired !
In my case, I have a complex object with a part of its data that should be versionned in time and I use for that a list of "revisions" between the object and the versionned data. That data is never manipulated without manipulating the object.
This is also a great advantage with nonrel database to avoid complex (and resource-intensive) relationships with recursive embedded objects.
OK. But you probably don't do versioning through REST but it is done automatically in the background and you do not expose those versions through API? Or you do?
So I will try to fix that you can define such resources. But to be able to access them through URI directly, this will be for some other time (and of course patches are welcome).
Yes, versionning is done in the background, but I would have the revisions list exposed so that a user could, for example, view/compare and revert to a specific revision.
Having directly access to a revision through the API is not required since each of them are listed in the main object. But only giving the current revision and allowing to get others on demand would be indeed (no waste of bandwidth, small objects).
Thank you for spending time on this issue, I will try for sure to have this working and submit you some patches.
Fixed. Please check.
Great ! Working wery well ! Thanks a lot.
I will probably try to get access to the subresources through the API in the next couple of weeks. I'll keep you informed and eventually submit a pull request.
Hi, First of all, thanks thanks to every contributor on this project, it is very useful when playing with tastypie !
I am encountering a little problem with nested list of embedded documents. This is a little diff on the test project to reproduce the issue :
After populating the database :
And when accessing to /api/v1/embeddedlistfieldtest/, we get an error : "init() takes at least 3 arguments (2 given)" :
And then, to be honest, I don't know what's happening : as far as I know, parent should be a MongoEngineResource, inherited from tastypie.ModelResource, inherited from tastypie.Resource, which only takes the api_name as parameter...
Thanks in advance for spending your time on this. Leo.