Add created datetime to Comment model
This commit is contained in:
parent
f021a9ff49
commit
4c4ee442d3
2 changed files with 2 additions and 1 deletions
|
@ -12,6 +12,7 @@ from app.services.database import get_db
|
|||
|
||||
class Comment(Model):
|
||||
url = CharField()
|
||||
created = DateTimeField()
|
||||
published = DateTimeField()
|
||||
author_name = CharField()
|
||||
author_email = CharField(default='')
|
||||
|
|
|
@ -61,7 +61,6 @@ def convert_comment(db, site, filename):
|
|||
if 'site' in d:
|
||||
comment.author_site = d['site']
|
||||
if 'url' in d:
|
||||
logger.info(d['url'][:6])
|
||||
if d['url'][:7] == 'http://':
|
||||
comment.url = d['url'][7:]
|
||||
elif d['url'][:8] == 'https://':
|
||||
|
@ -69,6 +68,7 @@ def convert_comment(db, site, filename):
|
|||
# else:
|
||||
# comment.url = d['article']
|
||||
if 'date' in d:
|
||||
comment.created = d['date']
|
||||
comment.published = d['date']
|
||||
comment.save()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue