Closed bpereto closed 3 years ago
I'm somewhat suspicious about the lack of the presence of any queryable_properties
source in the stack trace.
Since you are querying using the manager of a Host
model (which is not part of your provided model definition), does this Host
model also use a QueryablePropertiesManager
? If not, then that's likely the issue right there. You need to use a QueryablePropertiesManager
in all places that you want to make queries that utilize queryable properties from (even if the model itself does not define queryable properties and you only want to use queryable properties on other models via relations). This is because the property-resolving and auto-annotating logic is part of the queryset/query extension and is therefore only present if you explicitly use a QueryablePropertiesManager
/QueryablePropertiesQuerySet
.
The relevant part of the docs can be found here:
Using the special manager/queryset class may not only be important for models that define queryable properties. Since most features of queryable properties can also be used on related models in queryset operations, the manager is required whenever queryable property functionality should be offered, even if the corresponding model doesn’t implement its own queryable properties.
Let me know if this solves your problem or if there is another issue than the one I'm suspecting.
Didn't notice the relevant part in the docs. With enabling QueryablePropertiesManager in the required (related) models it works like a charm.
Hi,
run in this issue today. Any idea, why my approach doesn't work? In this case the annotated field seems to be interpreted as a lookup.
Model: