entity_event/models.py
def subset_subscriptions(self, subscriptions, entity=None):
        """Return only subscriptions the given entity is a part of.

        An entity is "part of a subscription" if either:

        1. The subscription is for that entity, with no
        sub-entity-kind. That is, it is not a group subscription.

        2. The subscription is for a super-entity of the given entity,
        and the subscription's sub-entity-kind is the same as that of
        the entity's.

        :type subscriptions: QuerySet
        :param subscriptions: A QuerySet of subscriptions to subset.

        :type entity: (optional) Entity
        :param entity: Subset subscriptions to only those relevant for
            this entity.

        :rtype: QuerySet
        :returns: A queryset of filtered subscriptions.
        """
        if entity is None:
            return subscriptions
        super_entities = EntityRelationship.objects.filter(
            sub_entity=entity).values_list('super_entity')
        subscriptions = subscriptions.filter(
            Q(entity=entity, sub_entity_kind=None) |
            Q(entity__in=super_entities, sub_entity_kind=entity.entity_kind)
        )

        return subscriptions
Return only subscriptions the given entity is a part of.

        An entity is "part of a subscription" if either:

        1. The subscription is for that entity, with no
        sub-entity-kind. That is, it is not a group subscription.

        2. The subscription is for a super-entity of the given entity,
        and the subscription's sub-entity-kind is the same as that of
        the entity's.

        :type subscriptions: QuerySet
        :param subscriptions: A QuerySet of subscriptions to subset.

        :type entity: (optional) Entity
        :param entity: Subset subscriptions to only those relevant for
            this entity.

        :rtype: QuerySet
        :returns: A queryset of filtered subscriptions.
        
Return only subscriptions the given entity is a part of.
An entity is "part of a subscription" if either.

1. The subscription is for that entity, with no
sub-entity-kind. That is, it is not a group subscription.

2. The subscription is for a super-entity of the given entity,
and the subscription's sub-entity-kind is the same as that of
the entity's.
Return only subscriptions the given entity is a part of . An entity is " part of a subscription " if either . 1 . The subscription is for that entity with no sub - entity - kind . That is it is not a group subscription . 2 . The subscription is for a super - entity of the given entity and the subscription ' s sub - entity - kind is the same as that of the entity ' s .
def subset_subscriptions(self, subscriptions, entity=None):
        if entity is None:
            return subscriptions
        super_entities = EntityRelationship.objects.filter(
            sub_entity=entity).values_list('super_entity')
        subscriptions = subscriptions.filter(
            Q(entity=entity, sub_entity_kind=None) |
            Q(entity__in=super_entities, sub_entity_kind=entity.entity_kind)
        )
        return subscriptions
def subset_subscriptions ( self , subscriptions , entity = None ) : if entity is None : return subscriptions super_entities = EntityRelationship . objects . filter ( sub_entity = entity ) . values_list ( 'super_entity' ) subscriptions = subscriptions . filter ( Q ( entity = entity , sub_entity_kind = None ) | Q ( entity__in = super_entities , sub_entity_kind = entity . entity_kind ) ) return subscriptions
Return only subscriptions the given entity is a part of.
Return only subscriptions the given entity is a part of .
"""Return only subscriptions the given entity is a part of.

        An entity is "part of a subscription" if either:

        1. The subscription is for that entity, with no
        sub-entity-kind. That is, it is not a group subscription.

        2. The subscription is for a super-entity of the given entity,
        and the subscription's sub-entity-kind is the same as that of
        the entity's.

        :type subscriptions: QuerySet
        :param subscriptions: A QuerySet of subscriptions to subset.

        :type entity: (optional) Entity
        :param entity: Subset subscriptions to only those relevant for
            this entity.

        :rtype: QuerySet
        :returns: A queryset of filtered subscriptions.
        """
A queryset of filtered subscriptions.
A queryset of filtered subscriptions .
QuerySet
self
subscriptions
A QuerySet of subscriptions to subset.
A QuerySet of subscriptions to subset .
entity
Subset subscriptions to only those relevant for
this entity.
Subset subscriptions to only those relevant for this entity .