X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/695023a09f7ed62d3a414dfc7c7b909fd0d1171b..2d5e46793f9b1f3f87f972114a4448da8efe740e:/edumed/utils.py diff --git a/edumed/utils.py b/edumed/utils.py index 2dce875..0683476 100644 --- a/edumed/utils.py +++ b/edumed/utils.py @@ -3,6 +3,10 @@ import codecs import csv import cStringIO +import pytz +from django.conf import settings +from django.utils import timezone + from settings.apps import INSTALLED_APPS @@ -41,4 +45,11 @@ def process_app_deps(list_with_deps): return tuple( (x[0] if type(x) == tuple else x) for x in list_with_deps - if type(x) != tuple or x[1] in INSTALLED_APPS) \ No newline at end of file + if type(x) != tuple or x[1] in INSTALLED_APPS) + + +def localtime_to_utc(localtime): + tz = pytz.timezone(settings.TIME_ZONE) + return timezone.utc.normalize( + tz.localize(localtime) + )