MCPcopy
hub / github.com/django/django / set_annotation_mask

Method set_annotation_mask

django/db/models/sql/query.py:2549–2566  ·  view source on GitHub ↗

Set the mask of annotations that will be returned by the SELECT.

(self, names)

Source from the content-addressed store, hash-verified

2547 self.deferred_loading = frozenset(field_names), False
2548
2549 def set_annotation_mask(self, names):
2550 """Set the mask of annotations that will be returned by the SELECT."""
2551 if names is None:
2552 self.annotation_select_mask = None
2553 else:
2554 self.annotation_select_mask = set(names)
2555 if self.selected:
2556 # Prune the masked annotations.
2557 self.selected = {
2558 key: value
2559 for key, value in self.selected.items()
2560 if not isinstance(value, str)
2561 or value in self.annotation_select_mask
2562 }
2563 # Append the unmasked annotations.
2564 for name in names:
2565 self.selected[name] = name
2566 self._annotation_select_cache = None
2567
2568 def append_annotation_mask(self, names):
2569 if self.annotation_select_mask is not None:

Callers 5

get_aggregationMethod · 0.95
add_annotationMethod · 0.95
clear_select_clauseMethod · 0.95
set_valuesMethod · 0.95

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected