Skip to content
This repository was archived by the owner on May 23, 2020. It is now read-only.

Commit 4736707

Browse files
committed
Update models.py
1 parent 6ff531d commit 4736707

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

update-1.1/blog/models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ def visit_on_site(self):
6161

6262
def json_default_post(self):
6363
domain = 'https://python.web.id'
64-
cover_url = ''
65-
if self.cover.url:
66-
cover_url = self.cover.url
67-
else:
64+
cover_url = 'None'
65+
try:
66+
cover_url = domain+str(self.cover.url)
67+
except:
6868
cover_url = cover_url
69+
6970
return dict(
7071
title = self.title,
7172
url = domain+"/blog/"+str(self.slug),
72-
cover = domain+str(self.cover.url),
73+
cover = cover_url,
7374
author = self.author.name,
7475
created = self.created.isoformat(),
7576
modified = self.modified.isoformat(),

0 commit comments

Comments
 (0)