fix timezone error with last_seen field
This commit is contained in:
parent
e7de4008ef
commit
266e579825
2 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@ from __future__ import division
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
import datetime
|
from django.utils import timezone
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from tkupek_elearning.elearning.models import Setting, Question, Option, UserAnswer, User, UserAnswerOptions
|
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):
|
def log_last_seen(user):
|
||||||
user.last_seen = datetime.datetime.now()
|
user.last_seen = timezone.now()
|
||||||
user.save()
|
user.save()
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,4 +173,4 @@ def statistic(request):
|
||||||
return render_to_response('statistic.html', {'settings': settings, 'users': users, 'questions': questions})
|
return render_to_response('statistic.html', {'settings': settings, 'users': users, 'questions': questions})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return render_to_response('access_denied.html', {'settings': settings})
|
return render_to_response('access_denied.html', {'settings': settings})
|
||||||
|
|
|
@ -104,7 +104,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'Europe/Berlin'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue