Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
default_timezoneを使うようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed Sep 24, 2014
1 parent cf7b23b commit b80da6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/kawaz/apps/blogs/models.py
Expand Up @@ -2,7 +2,7 @@
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.timezone import get_current_timezone
from django.utils.timezone import get_default_timezone
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from kawaz.core.db.decorators import validate_on_save
Expand Down Expand Up @@ -94,7 +94,7 @@ def clean(self):
@models.permalink
def get_absolute_url(self):
if self.publish_at:
tz = get_current_timezone()
tz = get_default_timezone()
publish_at = self.publish_at.astimezone(tz)
return ('blogs_entry_detail', (), {
'author': self.author.username,
Expand Down
6 changes: 3 additions & 3 deletions src/kawaz/apps/blogs/tests/views/test_crud.py
@@ -1,4 +1,4 @@
from django.utils.timezone import datetime, get_current_timezone
from django.utils.timezone import datetime, get_default_timezone
from django.conf import settings
from django.core.exceptions import ValidationError
from django.test import TestCase
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_author_can_update_via_update_view(self):
'title' : 'やっぱり書き換えます!',
'body' : 'うえーい',
})
tz = get_current_timezone()
tz = get_default_timezone()
publish_at = self.entry.publish_at.astimezone(tz)
self.assertRedirects(r, '/blogs/author_kawaztan/{0}/{1}/{2}/1/'.format(publish_at.year, publish_at.month, publish_at.day))
self.assertEqual(Entry.objects.count(), 1)
Expand All @@ -245,7 +245,7 @@ def test_user_cannot_modify_author_id(self):
'body' : 'うえーい',
'author' : other.pk # crackers attempt to masquerade
})
tz = get_current_timezone()
tz = get_default_timezone()
publish_at = self.entry.publish_at.astimezone(tz)
self.assertRedirects(r, '/blogs/author_kawaztan/{0}/{1}/{2}/1/'.format(publish_at.year, publish_at.month, publish_at.day))
self.assertEqual(Entry.objects.count(), 1)
Expand Down
4 changes: 2 additions & 2 deletions src/kawaz/apps/blogs/tests/views/test_date.py
@@ -1,11 +1,11 @@
from django.test import TestCase
from django.contrib.auth.models import AnonymousUser
from django.utils.timezone import get_current_timezone
from django.utils.timezone import get_default_timezone
from ..factories import EntryFactory
from kawaz.core.personas.tests.factories import PersonaFactory

def get_local_time(dt):
tz = get_current_timezone()
tz = get_default_timezone()
return dt.astimezone(tz)

class EntryYearArchiveViewTestCase(TestCase):
Expand Down

0 comments on commit b80da6e

Please sign in to comment.