Skip to content

Instantly share code, notes, and snippets.

@j00bar
Created September 3, 2014 16:52
Show Gist options
  • Select an option

  • Save j00bar/e27d4f722e8ac5f13780 to your computer and use it in GitHub Desktop.

Select an option

Save j00bar/e27d4f722e8ac5f13780 to your computer and use it in GitHub Desktop.
# Django 1.4 only allowed this
episodes = [
rel.episode for rel in series_obj.episode_relations.order_by('episode__title')
if rel.episode.showtime_set.filter(start__lte=end_date)
]
# Django 1.7 allows this
episodes = Episode.objects.filter(episoderelation__series=series_obj,
showtime__start__lte=end_date).order_by('title').distinct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment