From 266e579825c6920129d65e4e0644d89f2e3c813b Mon Sep 17 00:00:00 2001 From: tkupek Date: Sat, 19 Mar 2016 14:13:30 +0100 Subject: [PATCH] fix timezone error with last_seen field --- tkupek_elearning/elearning/views.py | 6 +++--- tkupek_elearning/settings.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tkupek_elearning/elearning/views.py b/tkupek_elearning/elearning/views.py index 5c11710..0a530de 100644 --- a/tkupek_elearning/elearning/views.py +++ b/tkupek_elearning/elearning/views.py @@ -2,7 +2,7 @@ from __future__ import division from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse from django.shortcuts import render_to_response -import datetime +from django.utils import timezone import json from tkupek_elearning.elearning.models import Setting, Question, Option, UserAnswer, User, UserAnswerOptions @@ -132,7 +132,7 @@ def get_user_answer(question, user): def log_last_seen(user): - user.last_seen = datetime.datetime.now() + user.last_seen = timezone.now() user.save() @@ -173,4 +173,4 @@ def statistic(request): return render_to_response('statistic.html', {'settings': settings, 'users': users, 'questions': questions}) else: - return render_to_response('access_denied.html', {'settings': settings}) \ No newline at end of file + return render_to_response('access_denied.html', {'settings': settings}) diff --git a/tkupek_elearning/settings.py b/tkupek_elearning/settings.py index 47c0eb0..3f03bb9 100644 --- a/tkupek_elearning/settings.py +++ b/tkupek_elearning/settings.py @@ -104,7 +104,7 @@ AUTH_PASSWORD_VALIDATORS = [ # https://docs.djangoproject.com/en/1.9/topics/i18n/ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Berlin' USE_I18N = True