Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

references to dynamic documents #63

Open
eelkeh opened this issue Aug 21, 2013 · 4 comments
Open

references to dynamic documents #63

eelkeh opened this issue Aug 21, 2013 · 4 comments

Comments

@eelkeh
Copy link

eelkeh commented Aug 21, 2013

Let's say I have an article document with a list of references to image documents (which are dynamic).

class Image(DynamicDocument):
   something = StringField(required=True)

class Article(Document):
    images = ListField(ReferenceField(Image))

class ArticleMongoResource(MongoEngineResource):
    images = fields.ReferencedListField(of='app.api.ImageResource',
                                    attribute='images', full=True, null=True)

class ImageResource(MongoEngineResource):
   ...   

Now when I POST and add a number of arbitrary fields to images they don't seem to picked up, it seems to behave like a regular document (not dynamic), i.e.:

{ "images": [{"something": "abc", "dynamic": "def" }]

Here the "dynamic" field isn't picked up and saved, it is stripped somewhere.
Is there anything wrong with above code? What could be the case here?

@eelkeh
Copy link
Author

eelkeh commented Sep 2, 2013

Any idea what could cause this behaviour?

@mitar
Copy link
Member

mitar commented Sep 2, 2013

Sorry. No time to check this currently. Can you check if we have a test to handle dynamic documents and compare? Does it work if there is reference list field, but is dynamic document a subdocument? Can you make a pull request with a test?

@eelkeh
Copy link
Author

eelkeh commented Sep 4, 2013

Added a test for a dynamic document which fails.

@mitar
Copy link
Member

mitar commented Sep 5, 2013

OK, as I said, I don't have much time for this now. Sorry. Will try to get back, but don't expect it too fast. So the whole interface between Tastypie and Mongoengine is a bit hackish, so for special features like this we might add another hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants