On May 13, 2:25 am, Thierry <lamthie...@gmail.com> wrote:
> My table has the following entry:
>
> id      name
> 1       foo's
>
> I'm currently trying the following:
>
> value = "foo's"
>
> MyModel.objects.get(name = value)
>
> The above is raising the exception DoesNotExist.  Doesn't the get
> function automatically escape the single quote?  Is there also a way
> to output the generated SQL of the above method?

No, there's no 'escaping' for database lookups. Are you sure the
element actually exists in the DB?

You can see the code (as long as DEBUG=True) by doing:
from django.db import connection
connection.queries
This is a FAQ, by the way.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to