On 12/3/07, Karen Tracey <[EMAIL PROTECTED]> wrote:
> I don't know how to go from raw sql to a QuerySet.  My own custom managers
> start with a model's default QuerySet and modify it using the standard
> exclude(), etc.

There are two ways to go from raw SQL to Django model objects. One
results in a QuerySet, and is based around actually doing two queries:
first fetch the primary key values from the rows you're interested in,
then feed those to a Django API method to get a QuerySet.

The other is to select the full list of values and then pass the
resulting rows one at a time into the model's constructor, which
doesn't get you a QuerySet but does get you model objects. Under the
hood, this is how QuerySet spits back objects when you ask for them.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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