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):
|
class Comment(Model):
|
||||||
url = CharField()
|
url = CharField()
|
||||||
|
created = DateTimeField()
|
||||||
published = DateTimeField()
|
published = DateTimeField()
|
||||||
author_name = CharField()
|
author_name = CharField()
|
||||||
author_email = CharField(default='')
|
author_email = CharField(default='')
|
||||||
|
|
|
@ -61,7 +61,6 @@ def convert_comment(db, site, filename):
|
||||||
if 'site' in d:
|
if 'site' in d:
|
||||||
comment.author_site = d['site']
|
comment.author_site = d['site']
|
||||||
if 'url' in d:
|
if 'url' in d:
|
||||||
logger.info(d['url'][:6])
|
|
||||||
if d['url'][:7] == 'http://':
|
if d['url'][:7] == 'http://':
|
||||||
comment.url = d['url'][7:]
|
comment.url = d['url'][7:]
|
||||||
elif d['url'][:8] == 'https://':
|
elif d['url'][:8] == 'https://':
|
||||||
|
@ -69,6 +68,7 @@ def convert_comment(db, site, filename):
|
||||||
# else:
|
# else:
|
||||||
# comment.url = d['article']
|
# comment.url = d['article']
|
||||||
if 'date' in d:
|
if 'date' in d:
|
||||||
|
comment.created = d['date']
|
||||||
comment.published = d['date']
|
comment.published = d['date']
|
||||||
comment.save()
|
comment.save()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue