On 31 jul, 12:45, Greg <[EMAIL PROTECTED]> wrote:
>
> Does anybody know what i need to do so that I don't receive this error
> when the query returns nothing?
>

  There's a difference with get() and filter(). get() always returns
an object and it must be use when you're sure you've got records. In
any other situation you can use filter and then validate it:

style = Style.objects.filter(id=a.id)
if len(style) > 0:
 """
   There's at least one record.
""


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