File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99from aboutcode .notifications .models import AbstractWebhookDelivery
1010from aboutcode .notifications .models import AbstractWebhookSubscription
11+ from aboutcode .notifications .models import WebhookSubscriptionQuerySetMixin
1112
1213__version__ = "0.1.0"
1314
14- __all__ = ["AbstractWebhookSubscription" , "AbstractWebhookDelivery" ]
15+ __all__ = [
16+ "AbstractWebhookSubscription" ,
17+ "AbstractWebhookDelivery" ,
18+ "WebhookSubscriptionQuerySetMixin" ,
19+ ]
Original file line number Diff line number Diff line change 1919logger = logging .getLogger (__name__ )
2020
2121
22+ class WebhookSubscriptionQuerySetMixin :
23+ """Mixin for WebhookSubscription querysets. Combine with the project's base QuerySet."""
24+
25+ def active (self ):
26+ return self .filter (is_active = True )
27+
28+
2229class AbstractWebhookSubscription (models .Model ):
2330 """
2431 Abstract base for Webhook subscription models.
Original file line number Diff line number Diff line change 1515
1616from aboutcode .notifications import AbstractWebhookDelivery
1717from aboutcode .notifications import AbstractWebhookSubscription
18+ from aboutcode .notifications import WebhookSubscriptionQuerySetMixin
1819from dje .models import DataspacedModel
1920from dje .models import DataspacedQuerySet
2021
2122logger = logging .getLogger ("dje" )
2223
2324
24- class WebhookSubscriptionQuerySet (DataspacedQuerySet ):
25- def active (self ):
26- return self .filter (is_active = True )
25+ class WebhookSubscriptionQuerySet (WebhookSubscriptionQuerySetMixin , DataspacedQuerySet ):
26+ pass
2727
2828
2929class WebhookSubscription (DataspacedModel , AbstractWebhookSubscription ):
You can’t perform that action at this time.
0 commit comments