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

perf: don't eval attr just pass to isinstance #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TonisPiip
Copy link

Had a nasty issue where I had a large QS be a @class_property, and this code caused it to eval the QS, there's no need to eval it, just pass it directly do isinstance, if we really want a check, a is not None would be better.

But would be even better if this didn't loop over all properities, rather it used

cls._meta.related_objects

@TonisPiip
Copy link
Author

cls._meta._get_fields(reverse=True, forward=False) would be a better option,

I've swtiched to using class_method to avoid this issue, but this was a nasty surprise. :( a warning about using class_property in the docs would be good.

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

Successfully merging this pull request may close these issues.

1 participant