Aug 022009

filter()
retrieves a QuerySet which is like a list.
To retrieve a single object, use
get()
——————-
e.g.,
>>>Card.objects.get(name=’Hot Pot’)
<Card: Hot Pot>

Posted by weboom at 5:37 am Tagged with: , ,
Jul 252009

get( )
is a method available on any Python dictionary, letting you ask for the value of a particular key and specify a default to fall back on if the key doesn’t exist.
e.g.,
query=request.GET.get(’q’,”)
If there is no q, then query becomes empty string.

Posted by weboom at 1:04 pm Tagged with: ,
Switch to our mobile site
Top Footer