fix timezone error with last_seen field

This commit is contained in:
tkupek 2016-03-19 14:13:30 +01:00
parent e7de4008ef
commit 266e579825
2 changed files with 4 additions and 4 deletions

View file

@ -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()

View file

@ -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