Skip to content

Commit

Permalink
Fix of error raising on save with USE_TZ=False
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai.Konovalov committed Sep 22, 2016
1 parent 0c409f5 commit b872ca8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pinax/stripe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
import decimal

from django.utils import timezone
from django.conf import settings


def convert_tstamp(response, field_name=None):
tz = timezone.utc if settings.USE_TZ else None

if field_name and response.get(field_name):
return datetime.datetime.fromtimestamp(
response[field_name],
timezone.utc
tz
)
if response is not None and not field_name:
return datetime.datetime.fromtimestamp(
response,
timezone.utc
tz
)


Expand Down

0 comments on commit b872ca8

Please sign in to comment.