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

Model relationship with lazy='dynamic' doesn't return in ResourceRelationship #167

Open
andrico opened this issue Jul 19, 2019 · 0 comments

Comments

@andrico
Copy link

andrico commented Jul 19, 2019

I noticied when in a model you configured a field as lazy='dynamic', the ResourceRelationship faild because the relational object is a query, and not a InstrumentedList.

Possible Fix:

data_layers/alchemy.py:246

Add:

if hasattr(related_objects, 'all'): related_objects = InstrumentedList(related_objects.all())

We know the dynamic lazy relationships are only for many to many or ont to many. So we know if the related_objects var has the 'all' attribute, we must to call .all() and return the InstrumentedList to continue with the flow.

any other idea, please tell me!!

Sorry for my Englsih :-(

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

1 participant