mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
Enforce org dependency of notification template.
This commit is contained in:
parent
25fae0eafd
commit
d0d201863b
@ -98,4 +98,20 @@ class Migration(migrations.Migration):
|
||||
name='launch_type',
|
||||
field=models.CharField(default=b'manual', max_length=20, editable=False, choices=[(b'manual', 'Manual'), (b'relaunch', 'Relaunch'), (b'callback', 'Callback'), (b'scheduled', 'Scheduled'), (b'dependency', 'Dependency'), (b'workflow', 'Workflow'), (b'sync', 'Sync'), (b'scm', 'SCM Update')]),
|
||||
),
|
||||
|
||||
# Named URL
|
||||
migrations.AlterField(
|
||||
model_name='notificationtemplate',
|
||||
name='name',
|
||||
field=models.CharField(max_length=512),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='notificationtemplate',
|
||||
name='organization',
|
||||
field=models.ForeignKey(related_name='notification_templates', to='main.Organization', null=True),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='notificationtemplate',
|
||||
unique_together=set([('organization', 'name')]),
|
||||
),
|
||||
]
|
||||
|
||||
@ -27,7 +27,7 @@ logger = logging.getLogger('awx.main.models.notifications')
|
||||
__all__ = ['NotificationTemplate', 'Notification']
|
||||
|
||||
|
||||
class NotificationTemplate(CommonModel):
|
||||
class NotificationTemplate(CommonModelNameNotUnique):
|
||||
|
||||
NOTIFICATION_TYPES = [('email', _('Email'), CustomEmailBackend),
|
||||
('slack', _('Slack'), SlackBackend),
|
||||
@ -41,12 +41,13 @@ class NotificationTemplate(CommonModel):
|
||||
|
||||
class Meta:
|
||||
app_label = 'main'
|
||||
unique_together = ('organization', 'name')
|
||||
|
||||
organization = models.ForeignKey(
|
||||
'Organization',
|
||||
blank=False,
|
||||
null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='notification_templates',
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user