From ea090236166078ef159600d30ca87c96e54b20b0 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Jul 2018 13:54:50 -0400 Subject: [PATCH] Webhook admin form cleanup --- netbox/extras/admin.py | 5 +++-- netbox/extras/migrations/0012_webhooks.py | 4 ++-- netbox/extras/models.py | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/netbox/extras/admin.py b/netbox/extras/admin.py index 20a8f6f4e..2c5de5054 100644 --- a/netbox/extras/admin.py +++ b/netbox/extras/admin.py @@ -25,8 +25,9 @@ def order_content_types(field): # class WebhookForm(forms.ModelForm): - - payload_url = LaxURLField() + payload_url = LaxURLField( + label='URL' + ) class Meta: model = Webhook diff --git a/netbox/extras/migrations/0012_webhooks.py b/netbox/extras/migrations/0012_webhooks.py index 568c13c65..70c8e9c14 100644 --- a/netbox/extras/migrations/0012_webhooks.py +++ b/netbox/extras/migrations/0012_webhooks.py @@ -22,10 +22,10 @@ class Migration(migrations.Migration): ('type_update', models.BooleanField(default=False, help_text='Call this webhook when a matching object is updated.')), ('type_delete', models.BooleanField(default=False, help_text='Call this webhook when a matching object is deleted.')), ('payload_url', models.CharField(help_text='A POST will be sent to this URL when the webhook is called.', max_length=500, verbose_name='URL')), - ('http_content_type', models.PositiveSmallIntegerField(choices=[(1, 'application/json'), (2, 'application/x-www-form-urlencoded')], default=1)), + ('http_content_type', models.PositiveSmallIntegerField(choices=[(1, 'application/json'), (2, 'application/x-www-form-urlencoded')], default=1, verbose_name='HTTP content type')), ('secret', models.CharField(blank=True, help_text="When provided, the request will include a 'X-Hook-Signature' header containing a HMAC hex digest of the payload body using the secret as the key. The secret is not transmitted in the request.", max_length=255)), ('enabled', models.BooleanField(default=True)), - ('ssl_verification', models.BooleanField(default=True, help_text='Enable SSL certificate verification. Disable with caution!')), + ('ssl_verification', models.BooleanField(default=True, help_text='Enable SSL certificate verification. Disable with caution!', verbose_name='SSL verification')), ('obj_type', models.ManyToManyField(help_text='The object(s) to which this Webhook applies.', related_name='webhooks', to='contenttypes.ContentType', verbose_name='Object types')), ], ), diff --git a/netbox/extras/models.py b/netbox/extras/models.py index 5b7a2f456..9e1bd2724 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -65,7 +65,8 @@ class Webhook(models.Model): ) http_content_type = models.PositiveSmallIntegerField( choices=WEBHOOK_CT_CHOICES, - default=WEBHOOK_CT_JSON + default=WEBHOOK_CT_JSON, + verbose_name='HTTP content type' ) secret = models.CharField( max_length=255, @@ -80,11 +81,12 @@ class Webhook(models.Model): ) ssl_verification = models.BooleanField( default=True, + verbose_name='SSL verification', help_text="Enable SSL certificate verification. Disable with caution!" ) class Meta: - unique_together = ('payload_url', 'type_create', "type_update", "type_delete",) + unique_together = ('payload_url', 'type_create', 'type_update', 'type_delete',) def __str__(self): return self.name