mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 05:31:22 -03:30
set messages default
This commit is contained in:
parent
ec20081d74
commit
2b792573f8
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
from django.db import migrations, models
|
||||
|
||||
import awx.main.fields
|
||||
import awx.main.models.notifications
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@ -17,7 +18,7 @@ class Migration(migrations.Migration):
|
||||
migrations.AddField(
|
||||
model_name='notificationtemplate',
|
||||
name='messages',
|
||||
field=awx.main.fields.JSONField(default=dict,
|
||||
field=awx.main.fields.JSONField(default=awx.main.models.notifications.NotificationTemplate.default_messages,
|
||||
help_text='Optional custom messages for notification template.',
|
||||
null=True,
|
||||
blank=True),
|
||||
|
||||
@ -72,10 +72,16 @@ class NotificationTemplate(CommonModelNameNotUnique):
|
||||
|
||||
notification_configuration = JSONField(blank=False)
|
||||
|
||||
def default_messages():
|
||||
DEFAULT_MSG = "{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}: {{ url }}"
|
||||
return {'started': { 'message': DEFAULT_MSG, 'body': ''},
|
||||
'success': { 'message': DEFAULT_MSG, 'body': ''},
|
||||
'error': { 'message': DEFAULT_MSG, 'body': ''}}
|
||||
|
||||
messages = JSONField(
|
||||
null=True,
|
||||
blank=True,
|
||||
default=dict,
|
||||
default=default_messages,
|
||||
help_text=_('Optional custom messages for notification template.'))
|
||||
|
||||
def has_message(self, condition):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user