summaryrefslogtreecommitdiff
path: root/app/links/models.py
diff options
context:
space:
mode:
authorGitea <gitea@fake.local>2020-04-29 02:15:31 +0000
committerGitea <gitea@fake.local>2020-04-29 02:15:31 +0000
commitafe50e464d76690fc1fa7c6d72c0d6d7e743a527 (patch)
treeea2b277ddc3d9aaba2ffd3e92ebdcd5c5e6ce51f /app/links/models.py
parent9ce8f0ef97d06750c323785828620becf375058f (diff)
adding stuff from live server
Diffstat (limited to 'app/links/models.py')
-rw-r--r--app/links/models.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/links/models.py b/app/links/models.py
index 0255745..45d9c09 100644
--- a/app/links/models.py
+++ b/app/links/models.py
@@ -8,6 +8,7 @@ from django.apps import apps
from django.db import models
from django.utils import timezone
from django.core.mail import EmailMessage
+from django.core.mail import send_mail
from django.contrib.sitemaps import Sitemap
from django.db.models.signals import post_save
from django.dispatch import receiver
@@ -48,8 +49,12 @@ def email_link(link):
"""
subject = link.title
body = "%s\n\n%s\n\n\nvisit site:%s\n" % (link.title, link.description, link.url)
- msg = EmailMessage(subject, striptags(body), 'sng@luxagraf.net', ['sng+links@luxagraf.net'])
- msg.send()
+ send_mail(
+ subject,
+ body,
+ 'sng@luxagraf.net',
+ ['sng@luxagraf.net']
+ )
def get_upload_path(self, filename):
@@ -120,11 +125,8 @@ def post_save_events(sender, update_fields, created, instance, **kwargs):
if instance.body_markdown:
pass
else:
- try:
- md = get_source(instance.url)
- instance.body_markdown = md['markdown']
- except:
- pass
+ md = get_source(instance.url)
+ instance.body_markdown = md['markdown']
post_save.disconnect(post_save_events, sender=Link)
instance.save()
post_save.connect(post_save_events, sender=Link)