For Django models, is there a shortcut for seeing if a record exists?
Posted
by Rhubarb
on Stack Overflow
See other posts from Stack Overflow
or by Rhubarb
Published on 2010-05-18T01:33:43Z
Indexed on
2010/05/18
1:40 UTC
Read the original article
Hit count: 345
Say I have a table 'People', is there a way to just quickly check if a People object exists with a name of 'Fred'? I know I can query People.objects.filter(Name='Fred'), and then check the length of the returned result, but is there a way to do it in a more elegant way?
© Stack Overflow or respective owner