Skip to content

Commit

Permalink
Fix 'to' dates for a collection
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaith committed May 6, 2016
1 parent 8ebaf18 commit 893ecdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion talks/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from rest_framework import serializers, pagination
from rest_framework.fields import Field
import pytz
from datetime import datetime, timedelta


from talks.events.models import Event, Person, EventGroup
from talks.users.models import CollectionItem, TalksUserCollection, Collection, CollectedDepartment
Expand Down Expand Up @@ -302,7 +304,8 @@ def get_talks(self,obj):
if self.context['from-date']:
events = events.filter(start__gte=self.context['from-date'])
if self.context['to-date']:
events = events.filter(end__lte=self.context['to-date'])
# add a day to the 'to' date
events = events.filter(end__lte=self.context['to-date']+timedelta(1))

serializer = HALEventSerializer(events, many=True, read_only=True, context=self.context)
return serializer.data
Expand Down

0 comments on commit 893ecdd

Please sign in to comment.