mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-16 22:19:53 +02:00
Incoporate PR feedback
This commit is contained in:
@@ -315,7 +315,7 @@ class Job(models.Model):
|
||||
user=user,
|
||||
job_id=uuid.uuid4(),
|
||||
queue_name=rq_queue_name,
|
||||
notifications=notifications or JobNotificationChoices.NOTIFICATION_ALWAYS
|
||||
notifications=notifications if notifications is not None else JobNotificationChoices.NOTIFICATION_ALWAYS
|
||||
)
|
||||
job.full_clean()
|
||||
job.save()
|
||||
|
||||
@@ -120,6 +120,14 @@ class ScriptInputSerializer(serializers.Serializer):
|
||||
default=JobNotificationChoices.NOTIFICATION_ALWAYS,
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Default to script's Meta.notifications_default if set
|
||||
script = self.context.get('script')
|
||||
if script and script.python_class:
|
||||
self.fields['notifications'].default = script.python_class.notifications_default
|
||||
|
||||
def validate_schedule_at(self, value):
|
||||
"""
|
||||
Validates the specified schedule time for a script execution.
|
||||
|
||||
Reference in New Issue
Block a user