Skip to content

Commit

Permalink
fix news with no url
Browse files Browse the repository at this point in the history
  • Loading branch information
vamoss committed Apr 13, 2020
1 parent 21c4c04 commit 6d991dd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bootcamp/news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ def __str__(self):
def save(self, *args, **kwargs):
# extract metada from content url
data = fetch_metadata(self.content)
self.meta_url = data.get("url")
self.meta_type = data.get("type", "website")
self.meta_title = data.get("title")
self.meta_description = data.get("description")
self.meta_image = data.get("image")
if data:
self.meta_url = data.get("url")
self.meta_type = data.get("type", "website")
self.meta_title = data.get("title")
self.meta_description = data.get("description")
self.meta_image = data.get("image")

super().save(*args, **kwargs)
if not self.reply:
Expand Down

0 comments on commit 6d991dd

Please sign in to comment.