Switched to timezone-aware now() function.
This commit is contained in:
parent
ce91a19068
commit
618a152f23
@ -6,6 +6,7 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.utils import timezone
|
||||
from lostplaces.models import *
|
||||
|
||||
from lostplaces.forms import ExplorerCreationForm, ExplorerChangeForm
|
||||
|
@ -8,6 +8,7 @@ from django.db import models
|
||||
from django.core.files import File
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
from lostplaces.models import PlaceImage, Place
|
||||
from lostplaces.tests.models import ModelTestCase
|
||||
@ -26,7 +27,7 @@ class PlaceImageTestCase(ModelTestCase):
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=User.objects.get(username='testpeter').explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
@ -55,7 +56,7 @@ class PlaceImageTestCase(ModelTestCase):
|
||||
description='Im a description',
|
||||
filename=os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg'),
|
||||
place=place,
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer
|
||||
)
|
||||
|
||||
|
@ -4,6 +4,7 @@ from django.test import TestCase
|
||||
from django.db import models
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
from lostplaces.models import Place
|
||||
from lostplaces.tests.models import ModelTestCase
|
||||
@ -22,7 +23,7 @@ class PlaceTestCase(ModelTestCase):
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
|
@ -4,6 +4,7 @@ from django.test import TestCase, RequestFactory, Client
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib.auth.models import User, AnonymousUser
|
||||
from django.contrib.messages.storage.fallback import FallbackStorage
|
||||
from django.utils import timezone
|
||||
|
||||
from lostplaces.models import Place
|
||||
from lostplaces.views import IsAuthenticatedMixin
|
||||
@ -54,7 +55,7 @@ class TestIsPlaceSubmitterMixin(TestCase):
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
|
@ -3,6 +3,8 @@ import datetime
|
||||
from django.test import TestCase, Client
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
from lostplaces.models import Place
|
||||
from lostplaces.views import (
|
||||
@ -30,7 +32,7 @@ class TestPlaceCreateView(ViewTestCase):
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
@ -63,7 +65,7 @@ class TestPlaceListView(ViewTestCase):
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
@ -95,7 +97,7 @@ class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapableViewTestCaseMixi
|
||||
|
||||
place = Place.objects.create(
|
||||
name='Im a place',
|
||||
submitted_when=datetime.datetime.now(),
|
||||
submitted_when=timezone.now(),
|
||||
submitted_by=user.explorer,
|
||||
location='Testtown',
|
||||
latitude=50.5,
|
||||
|
Loading…
Reference in New Issue
Block a user