reviewboard.notifications.managers¶
Manager for WebHookTarget models.
- class WebHookTargetManager(*args, **kwargs)[source]¶
Bases:
Manager
Manages WebHookTarget models.
This provides a utility function for querying WebHookTargets for a given event.
- for_event(event: str, local_site_id: Optional[int] = None, repository_id: Optional[int] = None) list[WebHookTarget] [source]¶
Return a list of matching webhook targets for the given event.
- Parameters:
event (
str
) – The event name to match.local_site_id (
int
, optional) – The ID of theLocalSite
to restrict results to.repository_id (
int
, optional) – The ID of theRepository
to restrict results to.
- Returns:
The webhook targets which match the event.
- Return type:
- for_local_site(local_site: Optional[LocalSite] = None) QuerySet [source]¶
Return a list of webhooks on the local site.
- Parameters:
local_site (
reviewboard.site.models.LocalSite
, optional) – An optional local site.- Returns:
A queryset matching all accessible webhooks.
- Return type:
- can_create(user: User, local_site: Optional[LocalSite] = None) bool [source]¶
Return whether the user can create webhooks on the local site.
- Parameters:
user (
django.contrib.auth.models.User
) – The user to check for permissions.local_site (
reviewboard.site.models.LocalSite
, optional) – The current local site, if it exists.
- Returns:
Whether or not the use can create a webhook on the local site.
- Return type:
- __annotations__ = {}¶
- __slotnames__ = []¶