diff --git a/RIGS/ical.py b/RIGS/ical.py index 944d03a9..c276e512 100644 --- a/RIGS/ical.py +++ b/RIGS/ical.py @@ -18,7 +18,7 @@ class CalendarICS(ICalFeed): def items(self): #include events from up to 1 year ago start = datetime.datetime.now() - datetime.timedelta(days=365) - filter = Q(start_date__gte=start) + filter = Q(start_date__gte=start) & ~Q(status=models.Event.CANCELLED) return models.Event.objects.filter(filter).order_by('-start_date').select_related('person', 'organisation', 'venue', 'mic') @@ -46,11 +46,11 @@ class CalendarICS(ICalFeed): def item_start_datetime(self, item): #set start date to the earliest defined time for the event if item.meet_at: - startDateTime = item.meet_at + startDateTime = item.meet_at.replace(tzinfo=None) elif item.access_at: - startDateTime = item.access_at + startDateTime = item.access_at.replace(tzinfo=None) elif item.start_time: - startDateTime = datetime.datetime.combine(item.start_date,item.start_time) + startDateTime = datetime.datetime.combine(item.start_date,item.start_time).replace(tzinfo=None) else: startDateTime = item.start_date @@ -65,9 +65,9 @@ class CalendarICS(ICalFeed): endDateTime = item.end_date if item.start_time and item.end_time: # don't allow an event with specific end but no specific start - endDateTime = datetime.datetime.combine(endDateTime,item.end_time) + endDateTime = datetime.datetime.combine(endDateTime,item.end_time).replace(tzinfo=None) elif item.start_time: # if there's a start time specified then an end time should also be specified - endDateTime = datetime.datetime.combine(endDateTime+datetime.timedelta(days=1),datetime.time(00, 00)) + endDateTime = datetime.datetime.combine(endDateTime+datetime.timedelta(days=1),datetime.time(00, 00)).replace(tzinfo=None) #elif item.end_time: # end time but no start time - this is weird - don't think ICS will like it so ignoring # do nothing @@ -106,7 +106,7 @@ class CalendarICS(ICalFeed): desc += 'Notes:\n'+item.notes+'\n\n' base_url = "https://pyrigs.nottinghamtec.co.uk" - desc += 'URL = '+base_url+str(reverse_lazy('event_detail',kwargs={'pk':item.pk})) + desc += 'URL = '+base_url+str(item.get_absolute_url()) return desc @@ -119,7 +119,7 @@ class CalendarICS(ICalFeed): # return '' def item_updated(self, item): # some ical clients will display this - return item.last_edited_at + return item.last_edited_at.replace(tzinfo=None) def item_guid(self, item): # use the rig-id as the ical unique event identifier return item.pk \ No newline at end of file diff --git a/RIGS/templates/RIGS/profile_detail.html b/RIGS/templates/RIGS/profile_detail.html index 9e236ccc..4e9a58a1 100644 --- a/RIGS/templates/RIGS/profile_detail.html +++ b/RIGS/templates/RIGS/profile_detail.html @@ -48,7 +48,7 @@ {% if object.pk == user.pk %}
http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}
+ Click here to add to google calendar.No API Key Generated{% endif %} +