(self, fields_for_select: Collection[str] | None = None)
| 270 | self.query = self.query.orderby(field, order=ordering[1]) |
| 271 | |
| 272 | def _resolve_annotate(self, fields_for_select: Collection[str] | None = None) -> bool: |
| 273 | if not self._annotations: |
| 274 | return False |
| 275 | |
| 276 | annotation_info: dict[str, ResolveResult] = {} |
| 277 | for key, annotation in self._annotations.items(): |
| 278 | if isinstance(annotation, Term): |
| 279 | annotation_info[key] = ResolveResult(term=annotation) |
| 280 | else: |
| 281 | annotation_info[key] = annotation.resolve( |
| 282 | ResolveContext( |
| 283 | model=self.model, |
| 284 | table=self.model._meta.basetable, |
| 285 | annotations=self._annotations, |
| 286 | custom_filters=self._custom_filters, |
| 287 | ) |
| 288 | ) |
| 289 | |
| 290 | for key, info in annotation_info.items(): |
| 291 | for join in info.joins: |
| 292 | self._join_table(join) |
| 293 | if key in self._annotations and (fields_for_select is None or key in fields_for_select): |
| 294 | self.query._select_other(info.term.as_(key)) # type:ignore[arg-type] |
| 295 | |
| 296 | return any(info.term.is_aggregate for info in annotation_info.values()) |
| 297 | |
| 298 | def sql(self, params_inline=False) -> str: |
| 299 | """ |
no test coverage detected