This works for me in Postgres as well. This script:

from django.contrib.auth.models import User
qs = User.objects.filter(username='smilochik')
print qs.query.sql_with_params()

returns this output:
('SELECT "auth_user"."id", "auth_user"."username",
"auth_user"."first_name", "auth_user"."last_name",
"auth_user"."email", "auth_user"."password", "auth_user"."is_staff",
"auth_user"."is_active", "auth_user"."is_superuser",
"auth_user"."last_login", "auth_user"."date_joined" FROM "auth_user"
WHERE "auth_user"."username" = %s ', ('smilochik',))

If I go into django/db/backends/postgresql_psycopg2/operations.py (I'm
using Postgres, not Oracle), and just have quote_name "return name"
then I get this:

('SELECT auth_user.id, auth_user.username, auth_user.first_name,
auth_user.last_name, auth_user.email, auth_user.password,
auth_user.is_staff, auth_user.is_active, auth_user.is_superuser,
auth_user.last_login, auth_user.date_joined FROM auth_user WHERE
auth_user.username = %s ', ('smilochik',))

I don't know if it's safe to do this. I'm assuming that, as long as
there are no spaces in your table or field names, it should work.

I did try to trace from the class containing this quote to the actual
database connection (from both directions), but I don't see how it can
be cleanly overridden. I think the modification you made is probably
the best bet. I would definitely like to hear what an ORM expert would
say.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to