changed datetime.utcnow() to datetime.now() to give local time

master
nberting 7 years ago
parent 0b70070c1f
commit 1b9baec128

@ -111,11 +111,11 @@ class Chat(db.Model):
id = db.Column(db.Integer(), primary_key=True) id = db.Column(db.Integer(), primary_key=True)
message = db.Column(db.String(1000)) message = db.Column(db.String(1000))
time = Column(DateTime, default=datetime.datetime.utcnow) time = Column(DateTime, default=datetime.datetime.now)
def __init__(self, message): def __init__(self, message):
self.message = message self.message = message
self.time = datetime.datetime.utcnow() self.time = datetime.datetime.now()
class Stack(db.Model): class Stack(db.Model):
__tablename__ = 'stacks' __tablename__ = 'stacks'
@ -138,11 +138,11 @@ class Potential(db.Model):
__tablename__ = 'potential' __tablename__ = 'potential'
id = db.Column(db.Integer, primary_key = True) id = db.Column(db.Integer, primary_key = True)
ptitle = db.Column(db.String(50)) ptitle = db.Column(db.String(50))
time = db.Column(DateTime, default=datetime.datetime.utcnow()) time = db.Column(DateTime, default=datetime.datetime.now())
def __init__(self, ptitle): def __init__(self, ptitle):
self.ptitle = ptitle self.ptitle = ptitle
self.time = datetime.datetime.utcnow() self.time = datetime.datetime.now()
class AuthorSchema(Schema): class AuthorSchema(Schema):

@ -128,7 +128,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{%else%}<div style="padding-bottom:50px;"><i> No annotations yet for this book </i></div> {%else%}<div style="padding-bottom:70px;"><i> No annotations yet for this book </i></div>
{%endif%} {%endif%}
</div> </div>
<hr> <hr>

@ -572,7 +572,7 @@ def show_books():
socketio.emit('channel-' + str(1), { socketio.emit('channel-' + str(1), {
'username': 'Search form', 'username': 'Search form',
'text': search.search.data, 'text': search.search.data,
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M"))}, broadcast=True) 'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
# Save message # Save message
my_new_chat = Chat(message=newmsg) my_new_chat = Chat(message=newmsg)
db.session.add(my_new_chat) db.session.add(my_new_chat)
@ -638,7 +638,7 @@ def search_results(searchtype, query, viewby):
socketio.emit('channel-' + str(1), { socketio.emit('channel-' + str(1), {
'username': 'Search form', 'username': 'Search form',
'text': search.search.data, 'text': search.search.data,
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M"))}, broadcast=True) 'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
# Save message # Save message
my_new_chat = Chat(message=newmsg) my_new_chat = Chat(message=newmsg)
db.session.add(my_new_chat) db.session.add(my_new_chat)
@ -885,7 +885,7 @@ def new_message(message):
emit('channel-' + str(message['channel']), { emit('channel-' + str(message['channel']), {
'username': message['username'], 'username': message['username'],
'text': message['text'], 'text': message['text'],
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M")) 'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))
}, },
broadcast=True broadcast=True
) )

Loading…
Cancel
Save