diff --git a/badges/migrations/0002_auto_20150513_0429.py b/badges/migrations/0002_auto_20150513_0429.py index 5dc0d05..93673c2 100644 --- a/badges/migrations/0002_auto_20150513_0429.py +++ b/badges/migrations/0002_auto_20150513_0429.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- - from django.db import models, migrations -import datetime from django.conf import settings +from django.utils import timezone class Migration(migrations.Migration): @@ -26,7 +25,7 @@ class Migration(migrations.Migration): name='BadgeToUser', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('created', models.DateTimeField(default=datetime.datetime.now)), + ('created', models.DateTimeField(default=timezone.now)), ('badge', models.ForeignKey(to='badges.Badge', on_delete=models.CASCADE)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], diff --git a/badges/models.py b/badges/models.py index c52ae65..ad82096 100755 --- a/badges/models.py +++ b/badges/models.py @@ -1,7 +1,6 @@ - -from datetime import datetime - +from django.utils import timezone from django.contrib.auth import get_user_model + try: from django.urls import reverse except ImportError: @@ -83,7 +82,7 @@ class BadgeToUser(models.Model): badge = models.ForeignKey(Badge, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) - created = models.DateTimeField(default=datetime.now) + created = models.DateTimeField(default=timezone.now) from . import listeners