Can I filter a django model with a python list?

Posted by Rhubarb on Stack Overflow See other posts from Stack Overflow or by Rhubarb
Published on 2010-04-03T01:51:24Z Indexed on 2010/04/03 1:53 UTC
Read the original article Hit count: 380

Filed under:
|
|

Say I have a model object 'Person' defined, which has a field called 'Name'. And I have a list of people:

l = ['Bob','Dave','Jane']

I would like to return a list of all Person records where the first name is not in the list of names defined in l.

What is the most pythonic way of doing this?

© Stack Overflow or respective owner

Related posts about python

Related posts about django