Add support to tzinfo

This commit is contained in:
Marco Rougeth 2014-05-14 11:14:14 -03:00 committed by Martin Mahner
parent 34181e03f7
commit 9f1650693b

View file

@ -1,7 +1,7 @@
import datetime
import sys import sys
from optparse import make_option from optparse import make_option
from django.core.management.base import LabelCommand from django.core.management.base import LabelCommand
from django.utils import timezone
from dpaste.models import Snippet from dpaste.models import Snippet
class Command(LabelCommand): class Command(LabelCommand):
@ -15,7 +15,7 @@ class Command(LabelCommand):
deleteable_snippets = Snippet.objects.filter( deleteable_snippets = Snippet.objects.filter(
expires__isnull=False, expires__isnull=False,
expire_type=Snippet.EXPIRE_TIME, expire_type=Snippet.EXPIRE_TIME,
expires__lte=datetime.datetime.now() expires__lte=timezone.now()
) )
sys.stdout.write(u"%s snippets gets deleted:\n" % deleteable_snippets.count()) sys.stdout.write(u"%s snippets gets deleted:\n" % deleteable_snippets.count())
for d in deleteable_snippets: for d in deleteable_snippets: