Hello django community, I have a HUGE problem, and I would like to
know if some of you guys can help me, the problem is: Im accesing a
database and there is a big chance of not finding the item im looking
for, this is the snipplet of code im using and the "solution" that
I've implemented but it doesn't work as it should:

from django.core.exceptions import ObjectDoesNotExist

try:
     z=Dic.objects.filter(DB_Word=worfromtext).distinct()
     print z
except ObjectDoesNotExist:
    print 'ERROR!'

so the first part works well, if the object (in this case a word) is
in the database I can do something like printing the word in this
case, but if the object is not in the database and the exception is
raised, I cant do anything, for example the 'ERROR!' message wont
show, do you guys have any ideas of what could be wrong?

I got this piece of code from the Django Database API:

from django.core.exceptions import ObjectDoesNotExist
try:
    e = Entry.objects.get(id=3)
    b = Blog.objects.get(id=1)
except ObjectDoesNotExist:
    print "Either the entry or blog doesn't exist."

I suppose this example works but I havent tried it, even tho im doing
the same, I dont know what am I doing wrong, thanks for your time and
help

Gerard.


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