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>
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>
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.
