aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-02-06 00:02:31 +0100
committerneodarz <neodarz@neodarz.net>2019-02-06 00:02:31 +0100
commit74dbf4defed8ae348a327e4674d917b3dd869713 (patch)
tree36cf3c0f45b443616eccf4473e6c02e15e6a2347 /database
parentad6212da067fdc05a8564e79943692fd9d466110 (diff)
downloadkhanindexer-74dbf4defed8ae348a327e4674d917b3dd869713.tar.xz
khanindexer-74dbf4defed8ae348a327e4674d917b3dd869713.zip
Add date when page are crawled
Diffstat (limited to '')
-rw-r--r--database/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/database/models.py b/database/models.py
index a4c3f65..af7b6f5 100644
--- a/database/models.py
+++ b/database/models.py
@@ -1,7 +1,9 @@
-from peewee import Model, CharField, TextField, IntegerField, PostgresqlDatabase
+from peewee import Model, CharField, TextField, IntegerField, DateTimeField, PostgresqlDatabase
import config
+import datetime
+
db = PostgresqlDatabase(config.DB, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, password=config.DB_PASS, autocommit=True, autorollback=True)
class Page(Model):
@@ -12,6 +14,7 @@ class Page(Model):
title = CharField(null=True)
content = TextField(null=True)
content_length = IntegerField()
+ date_updated = DateTimeField(default=datetime.datetime.now)
class Meta:
database = db