1
0
Fork 0

Use timezone dates

Fixes #114
This commit is contained in:
Mouse Reeve 2020-03-29 17:40:51 -07:00
parent da69b82d8a
commit 9aada80c05
9 changed files with 61 additions and 43 deletions

View file

@ -1,11 +1,12 @@
''' Routine tasks for keeping your library tidy '''
from datetime import datetime, timedelta
from datetime import timedelta
from django.utils import timezone
from fedireads import books_manager
from fedireads import models
def sync_book_data():
''' update books with any changes to their canonical source '''
expiry = datetime.now() - timedelta(days=1)
expiry = timezone.now() - timedelta(days=1)
books = models.Book.objects.filter(
sync=True,
last_sync_date__lte=expiry