MCPcopy Create free account
hub / github.com/WebODM/WebODM / ConfigurationForm

Class ConfigurationForm

coreplugins/tasknotification/plugin.py:12–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10from . import config
11
12class ConfigurationForm(forms.Form):
13 notification_app_name = forms.CharField(
14 label='App name',
15 max_length=100,
16 required=True,
17 )
18 smtp_to_address = forms.EmailField(
19 label='Send Notification to Address',
20 max_length=100,
21 required=True
22 )
23 smtp_from_address = forms.EmailField(
24 label='From Address',
25 max_length=100,
26 required=True
27 )
28 smtp_server = forms.CharField(
29 label='SMTP Server',
30 max_length=100,
31 required=True
32 )
33 smtp_port = forms.IntegerField(
34 label='Port',
35 required=True
36 )
37 smtp_username = forms.CharField(
38 label='Username',
39 max_length=100,
40 required=True
41 )
42 smtp_password = forms.CharField(
43 label='Password',
44 max_length=100,
45 required=True
46 )
47 smtp_use_tls = forms.BooleanField(
48 label='Use Transport Layer Security (TLS)',
49 required=False,
50 )
51
52 notify_task_completed = forms.BooleanField(
53 label='Notify Task Completed',
54 required=False,
55 )
56 notify_task_failed = forms.BooleanField(
57 label='Notify Task Failed',
58 required=False,
59 )
60 notify_task_removed = forms.BooleanField(
61 label='Notify Task Removed',
62 required=False,
63 )
64
65 def test_settings(self, request):
66 try:
67 settings = Setting.objects.first()
68 email.send(f'{self.cleaned_data["notification_app_name"]} - Testing Notification', 'Hi, just testing if notification is working', self.cleaned_data)
69 messages.success(request, f"Email sent successfully, check your inbox at {self.cleaned_data.get('smtp_to_address')}")

Callers 1

indexMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected