How do you get QuerySet on a list of possible parameters?



  • How do we proceed with the design described below?

    list_of_foreign_keys = [foreign_key1, foreign_key2, ...]
    Model.objects.filter(date__range=[start_date, end_date],
                         # ... some parameters
                         foreign_key = list_of_foreign_keys,)
    

    list_of_foreign_keys - a list of possible keys.



  • If I understand correctly, you need to:

    foreign_key__in=list_of_foreign_keys
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2