mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 20:11:14 +00:00
Resolves timezone warnings
This commit is contained in:
parent
ef9e130669
commit
64abdafcba
2 changed files with 5 additions and 3 deletions
|
@ -8,6 +8,7 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.http.response import Http404
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils import timezone
|
||||
|
||||
from bookwyrm import forms, models, view_actions as actions
|
||||
from bookwyrm.settings import DOMAIN
|
||||
|
@ -361,7 +362,7 @@ class ViewActions(TestCase):
|
|||
|
||||
def test_edit_readthrough(self):
|
||||
''' adding dates to an ongoing readthrough '''
|
||||
start = dateutil.parser.parse('2021-01-03')
|
||||
start = timezone.make_aware(dateutil.parser.parse('2021-01-03'))
|
||||
readthrough = models.ReadThrough.objects.create(
|
||||
book=self.book, user=self.local_user, start_date=start)
|
||||
request = self.factory.post(
|
||||
|
|
|
@ -836,7 +836,7 @@ def update_readthrough(request, book=None, create=True):
|
|||
start_date = request.POST.get('start_date')
|
||||
if start_date:
|
||||
try:
|
||||
start_date = dateutil.parser.parse(start_date)
|
||||
start_date = timezone.make_aware(dateutil.parser.parse(start_date))
|
||||
readthrough.start_date = start_date
|
||||
except ParserError:
|
||||
pass
|
||||
|
@ -844,7 +844,8 @@ def update_readthrough(request, book=None, create=True):
|
|||
finish_date = request.POST.get('finish_date')
|
||||
if finish_date:
|
||||
try:
|
||||
finish_date = dateutil.parser.parse(finish_date)
|
||||
finish_date = timezone.make_aware(
|
||||
dateutil.parser.parse(finish_date))
|
||||
readthrough.finish_date = finish_date
|
||||
except ParserError:
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue