Ticket #12251: 12251.queryset_in_bulk_set.diff

File 12251.queryset_in_bulk_set.diff, 1.1 KB (added by Johannes Dollinger, 15 years ago)
  • tests/modeltests/lookup/models.py

     
    102102<Article: Article 2>
    103103>>> Article.objects.in_bulk([3])
    104104{3: <Article: Article 3>}
     105>>> Article.objects.in_bulk(set([3]))
     106{3: <Article: Article 3>}
     107>>> Article.objects.in_bulk(frozenset([3]))
     108{3: <Article: Article 3>}
     109>>> Article.objects.in_bulk((3,))
     110{3: <Article: Article 3>}
    105111>>> Article.objects.in_bulk([1000])
    106112{}
    107113>>> Article.objects.in_bulk([])
  • django/db/models/query.py

     
    356356        """
    357357        assert self.query.can_filter(), \
    358358                "Cannot use 'limit' or 'offset' with in_bulk"
    359         assert isinstance(id_list, (tuple,  list)), \
     359        assert isinstance(id_list, (tuple, list, set, frozenset)), \
    360360                "in_bulk() must be provided with a list of IDs."
    361361        if not id_list:
    362362            return {}
Back to Top