aboutsummaryrefslogtreecommitdiffstats
path: root/servo/models
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-11-24 13:28:55 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-11-24 13:28:55 +0200
commit28f4a5677b8f485224ef7df675228ccf657dcb75 (patch)
treeed6bb72c4bc2e2113a0e543f879b9d0ac335c739 /servo/models
parentc7432daca9a2cfd5ab506552446700932a99bc33 (diff)
downloadServo-28f4a5677b8f485224ef7df675228ccf657dcb75.tar.gz
Servo-28f4a5677b8f485224ef7df675228ccf657dcb75.tar.bz2
Servo-28f4a5677b8f485224ef7df675228ccf657dcb75.zip
Add SSL/TLS/None choices to SMTP settings
Diffstat (limited to 'servo/models')
-rw-r--r--servo/models/device.py4
-rw-r--r--servo/models/note.py16
2 files changed, 14 insertions, 6 deletions
diff --git a/servo/models/device.py b/servo/models/device.py
index 95635df..df28671 100644
--- a/servo/models/device.py
+++ b/servo/models/device.py
@@ -188,7 +188,7 @@ class Device(models.Model):
help_text=_('Device is considered vintage in GSX')
)
fmip_active = models.BooleanField(default=False, editable=False)
-
+
def is_apple_device(self):
"""
Checks if this is a valid Apple device SN
@@ -395,7 +395,7 @@ class Device(models.Model):
return self.photo.url
except ValueError:
return self.get_image_url()
-
+
def get_fmip_status(self):
"""
Returns the translated FMiP status
diff --git a/servo/models/note.py b/servo/models/note.py
index a598a95..8b2943f 100644
--- a/servo/models/note.py
+++ b/servo/models/note.py
@@ -382,7 +382,16 @@ class Note(MPTTModel):
if len(smtp_host) > 1:
settings.EMAIL_PORT = int(smtp_host[1])
- settings.EMAIL_USE_TLS = config.get('smtp_ssl')
+ if config.get('SMTP_ENCRYPTION') == 'TLS':
+ settings.EMAIL_USE_TLS = True
+
+ if config.get('SMTP_ENCRYPTION') == 'SSL':
+ settings.EMAIL_USE_SSL = True
+
+ if config.get('SMTP_ENCRYPTION') == 'OFF':
+ settings.EMAIL_USE_SSL = False
+ settings.EMAIL_USE_TLS = False
+
settings.EMAIL_HOST_USER = str(config.get('smtp_user'))
settings.EMAIL_HOST_PASSWORD = str(config.get('smtp_password'))
@@ -630,9 +639,8 @@ class Article(models.Model):
('LOW', _('Low')),
)
priority = models.CharField(max_length=128,
- choices=PRIORITY_CHOICES,
- default=PRIORITY_CHOICES[0][0]
- )
+ choices=PRIORITY_CHOICES,
+ default=PRIORITY_CHOICES[0][0])
url = models.URLField(default='')
product_model = ArrayField(models.CharField(max_length=128),
null=True,