Добавил timestamp создания записи
This commit is contained in:
parent
755e7c5ce4
commit
7c7db5bca0
5
main.py
5
main.py
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
from bottle import abort, route, run, request
|
from bottle import abort, route, run, request
|
||||||
import pymongo
|
import pymongo
|
||||||
|
import time
|
||||||
# TODO: auth to /admin
|
# TODO: auth to /admin
|
||||||
# TODO: timestamps to posts
|
# TODO: timestamps to posts
|
||||||
# TODO: author to posts and multiple users
|
# TODO: author to posts and multiple users
|
||||||
@ -95,7 +95,8 @@ class Back():
|
|||||||
return str(posts.update_one({'name': name}, newPost))
|
return str(posts.update_one({'name': name}, newPost))
|
||||||
# Else - create new
|
# Else - create new
|
||||||
else:
|
else:
|
||||||
newPost = {'name': name, 'text': body}
|
newPost = {'name': name, 'text': body,
|
||||||
|
'create_timestamp': str(time.time())}
|
||||||
return str(posts.insert_one(newPost).inserted_id)
|
return str(posts.insert_one(newPost).inserted_id)
|
||||||
|
|
||||||
def deletePost(self, name):
|
def deletePost(self, name):
|
||||||
|
Loading…
Reference in New Issue
Block a user