diff options
Diffstat (limited to 'app/links/models.py')
-rw-r--r-- | app/links/models.py | 16 |
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) |