On 18-Dec-07, at 10:33 AM, MrJogo wrote:

> What's the practical difference between calling
> DB.objects.filter(**kwargs) and DB.objects.get(**kwargs) (where
> **kwargs can be whichever paramenters)? I understand that filter
> returns a QuerySet, but I don't really get how that affects me or my
> code.

get will return precisely one object. whereas filter will return a  
list of objects (list may contain only one object or be empty. So the  
difference is that if you do

a = ...get()
you can write a.id
a= ...filter()
you would have to write a[0].id (if you are expecting only one object  
to be returned)

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to