Skip to content

Instantly share code, notes, and snippets.

@renyi
Created January 13, 2013 03:23
Show Gist options
  • Select an option

  • Save renyi/4522071 to your computer and use it in GitHub Desktop.

Select an option

Save renyi/4522071 to your computer and use it in GitHub Desktop.
# Chaining filter()
ateacher_list = teacher_list.filter(Q(asubjects__in=[subject])).filter(~Q(subjects__in=[subject]).distinct()
# Using Q() & Q()
ateacher_list = teacher_list.filter(
Q(asubjects__in=[subject]) & ~Q(subjects__in=[subject]
).distinct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment