mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
Notification endpoints and url expositions
Also some changes to the footprint of the notification handler classes
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from awx.main.models.base import * # noqa
|
||||
from awx.main.notifications.email_backend import CustomEmailBackend
|
||||
from awx.main.notifications.slack_backend import SlackBackend
|
||||
@@ -14,6 +17,8 @@ from jsonfield import JSONField
|
||||
|
||||
logger = logging.getLogger('awx.main.models.notifications')
|
||||
|
||||
__all__ = ['NotificationTemplate']
|
||||
|
||||
class NotificationTemplate(CommonModel):
|
||||
|
||||
NOTIFICATION_TYPES = [('email', _('Email'), CustomEmailBackend),
|
||||
@@ -32,6 +37,9 @@ class NotificationTemplate(CommonModel):
|
||||
|
||||
notification_configuration = JSONField(blank=False)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('api:notification_template_detail', args=(self.pk,))
|
||||
|
||||
@property
|
||||
def notification_class(self):
|
||||
return CLASS_FOR_NOTIFICATION_TYPE[self.notification_type]
|
||||
|
||||
Reference in New Issue
Block a user