def get_all_entities(self, membership_cache=None, entities_by_kind=None, return_models=False, is_active=True):
<EOL>if membership_cache is None:<EOL><INDENT>membership_cache = EntityGroup.objects.get_membership_cache([self.id], is_active=is_active)<EOL><DEDENT>if entities_by_kind is None:<EOL><INDENT>entities_by_kind = entities_by_kind or get_entities_by_kind(membership_cache=membership_cache)<EOL><DEDENT>entity_ids = set()<EOL>if membership_cache.get(self.id):<EOL><INDENT>for entity_id, entity_kind_id in membership_cache[self.id]:<EOL><INDENT>if entity_id:<EOL><INDENT>if entity_kind_id:<EOL><INDENT>entity_ids.update(entities_by_kind[entity_kind_id][entity_id])<EOL><DEDENT>else:<EOL><INDENT>entity_ids.add(entity_id)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>entity_ids.update(entities_by_kind[entity_kind_id]['<STR_LIT:all>'])<EOL><DEDENT><DEDENT><DEDENT>if return_models:<EOL><INDENT>return Entity.objects.filter(id__in=entity_ids)<EOL><DEDENT>return entity_ids<EOL>
Returns a list of all entity ids in this group or optionally returns a queryset for all entity models.
In order to reduce queries for multiple group lookups, it is expected that the membership_cache and
entities_by_kind are built outside of this method and passed in as arguments.
:param membership_cache: A group cache dict generated from `EntityGroup.objects.get_membership_cache()`
:type membership_cache: dict
:param entities_by_kind: An entities by kind dict generated from the `get_entities_by_kind` function
:type entities_by_kind: dict
:param return_models: If True, returns an Entity queryset, if False, returns a set of entity ids
:type return_models: bool
:param is_active: Flag to control entities being returned. Defaults to True for active entities only
:type is_active: bool