Added timezone to start/end datetimes
This commit is contained in:
parent
a37d620afb
commit
d6ac7edc5d
1 changed files with 5 additions and 3 deletions
|
@ -1,10 +1,12 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import json
|
import json
|
||||||
|
import pytz
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
from django.shortcuts import render, get_object_or_404, redirect
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
from django.template import loader, Context
|
from django.template import loader, Context
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
@ -261,7 +263,7 @@ def schedule_json(request):
|
||||||
class EventFeed(ICalFeed):
|
class EventFeed(ICalFeed):
|
||||||
|
|
||||||
product_id = '-//linux.conf.au/schedule//EN'
|
product_id = '-//linux.conf.au/schedule//EN'
|
||||||
timezone = 'Australia/Tasmania'
|
timezone = settings.TIME_ZONE
|
||||||
filename = 'conference.ics'
|
filename = 'conference.ics'
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
|
@ -283,10 +285,10 @@ class EventFeed(ICalFeed):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def item_start_datetime(self, item):
|
def item_start_datetime(self, item):
|
||||||
return item.start_datetime
|
return pytz.timezone(settings.TIME_ZONE).localize(item.start_datetime)
|
||||||
|
|
||||||
def item_end_datetime(self, item):
|
def item_end_datetime(self, item):
|
||||||
return item.end_datetime
|
return pytz.timezone(settings.TIME_ZONE).localize(item.end_datetime)
|
||||||
|
|
||||||
def item_location(self, item):
|
def item_location(self, item):
|
||||||
return ", ".join(room["name"] for room in item.rooms.values())
|
return ", ".join(room["name"] for room in item.rooms.values())
|
||||||
|
|
Loading…
Reference in a new issue