{{{
query_set = ModelClass.objects.filter([other_filters]).exclude(field='')
}}}
The `query_set.query` then contains somthing like:
{{{
SELECT [columns] FROM [table] WHERE [other_filters] AND NOT ([table].field
= ))
}}}
The QuerySet works, but note that there are no quotes around the empty
string value.
I tried with a value instead, which also does not get quoted. Even if it
contains spaces.
The issue is the same if I use `.filter()` instead of `.exclude()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/25416>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0
Comment:
Hi beruic,
The string representation of a `Query` is not meant to be valid SQL, it is
solely provided for introspection means.
Were you using this private API in order to generate SQL to execute your
query manually?
--
Ticket URL: <https://code.djangoproject.com/ticket/25416#comment:1>
* resolution: needsinfo => invalid
Comment:
I don't know why my replies does not show here, so now I try a straight
comment instead:
I recon that I have misinterpreted the purpose of `query_set.query`, and
this ticket is thus invalid.
--
Ticket URL: <https://code.djangoproject.com/ticket/25416#comment:2>