You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because FeatureType.get_bounding_box function uses self.get_query_set() that does not check any feature relations.
Suggested fix:
Change function FeatureType.get_bounding_box not to use get_query_set() as such but add a .only(self.geometry_field.name)
so line: bbox = self.get_queryset().aggregate(a=Extent(geo_expression))["a"]
to: bbox = self.get_queryset().only(self.geometry_field.name).aggregate(a=Extent(geo_expression))["a"]
or even: bbox = self.queryset.only(self.geometry_field.name).aggregate(a=Extent(geo_expression))["a"]
I am not so familiar with the codebase that really not sure if this is the way to go here, maybe someone who actually is doing dev on this will do the actual fix in a different way. Atleast this way there would be no need for any prefetches.
The text was updated successfully, but these errors were encountered:
If a FeatureField has reference to a different model via FK reference, GetCapabilities query is not working.
eg.
FeatureField( "not_working", model_attribute="some_fk.field_name", abstract="does not work", )
Result from eg. http://localhost:8000/wfs/?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities
Now would be 500 internal server error.
Reason would be that "<feature_type> has no attribute field_name"
This is because FeatureType.get_bounding_box function uses self.get_query_set() that does not check any feature relations.
Suggested fix:
Change function FeatureType.get_bounding_box not to use get_query_set() as such but add a .only(self.geometry_field.name)
so line:
bbox = self.get_queryset().aggregate(a=Extent(geo_expression))["a"]
to:
bbox = self.get_queryset().only(self.geometry_field.name).aggregate(a=Extent(geo_expression))["a"]
or even:
bbox = self.queryset.only(self.geometry_field.name).aggregate(a=Extent(geo_expression))["a"]
I am not so familiar with the codebase that really not sure if this is the way to go here, maybe someone who actually is doing dev on this will do the actual fix in a different way. Atleast this way there would be no need for any prefetches.
The text was updated successfully, but these errors were encountered: