Skip to content

Instantly share code, notes, and snippets.

@pretzelhands
Created December 2, 2020 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pretzelhands/f7ce276bf5d59f5ac5ca9e25a37ee0d0 to your computer and use it in GitHub Desktop.
Save pretzelhands/f7ce276bf5d59f5ac5ca9e25a37ee0d0 to your computer and use it in GitHub Desktop.
# Return next 60 days by default
start = datetime.combine(date.today(), time(0, 0))
end = start + timedelta(days=60)
logging.error('//////////////////////////////////////// IT IS WHAT IT IS: {} {}'.format(start, end))
if (start := self.request.query_params.get('start')) and (end := self.request.query_params.get('end')):
start = datetime.combine(datetime.strptime(start, '%Y-%m-%d').date(), time(0, 0))
end = datetime.combine(datetime.strptime(end, '%Y-%m-%d').date(), time(23, 59))
logging.error('||||||||||||||||||||||||||||||||||||||||||||| WHATS GOING ON HERE: {} {}'.format(start, end))
# Endpoints
#
# /shows/1/schedules/1/timeslots/
#
# Returns timeslots of the given show and schedule
#
if show_pk and schedule_pk:
logging.error('############################################# {} {}'.format(start, end))
return TimeSlot.objects.filter(show=show_pk, schedule=schedule_pk, start__gte=start, end__lte=end).order_by('start')
ERROR:root://////////////////////////////////////// IT IS WHAT IT IS: 2020-12-02 00:00:00 2021-01-31 00:00:00
ERROR:root:############################################# None 2021-01-31 00:00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment