Hi,
For Question & Answer models:
Question.objects.filter(answer__isnull=False)
returns the set of questions that has at least one answer, but:
Question.objects.filter(answer__isnull=True)
does not return the questions that has no answer.
Am I missing something?
Thanks,
oMat
--~--~--
On 9/6/07, omat <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> For Question & Answer models:
>
> Question.objects.filter(answer__isnull=False)
>
> returns the set of questions that has at least one answer, but:
>
> Question.objects.filter(answer__isnull=True)
>
> does not return the questions that has no
On Thu, 2007-09-06 at 20:59 +0800, Russell Keith-Magee wrote:
> On 9/6/07, omat <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > For Question & Answer models:
> >
> > Question.objects.filter(answer__isnull=False)
> >
> > returns the set of questions that has at least one answer, but:
> >
> > Questio
On 9/6/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> > When you run Question.objects.filter(answer__isnull=True), this gets
> > turned into an SQL query something like:
> >
> > SELECT Question.* from Question INNER JOIN Answer WHERE Question.id =
> > Answer.question_id WHERE Answer.id IS N
Thanks for clarifying this with such a detailed explanation.
I took the first way you have suggested and get things working with
the following manager:
class QuestionManager(models.Manager):
def get_not_answered(self):
cursor = connection.cursor()
cursor.execute("""SELECT que
Malcolm, these are the models:
class Question(models.Model):
question = models.CharField(max_length=150)
slug = models.SlugField(max_length=150,
editable=False)
verb = models.ForeignKey(Verb)
added = models.DateTimeField(editable=False)
user = model
When I checked the queries generated, it appears that the isnull
lookups result in INNER JOINs for my case.
On 6 Eylül, 16:38, omat <[EMAIL PROTECTED]> wrote:
> Malcolm, these are the models:
>
> class Question(models.Model):
> question = models.CharField(max_length=150)
> slug = models
On Thu, 2007-09-06 at 21:25 +0800, Russell Keith-Magee wrote:
> On 9/6/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> >
> > > When you run Question.objects.filter(answer__isnull=True), this gets
> > > turned into an SQL query something like:
> > >
> > > SELECT Question.* from Question INNER J
Hi Malcolm,
On Fri, Sep 07, Malcolm Tredinnick wrote:
> My bad; you're right. Only m2m does outer joins on trunk at the
> moment.:(
>
> I've been looking at the new stuff too much lately. This problem is
> fixed there, so if people can wait until that lands very shortly it will
> go away.
this
On 9/6/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>
> I'd *love* to have a sneak preview of your changes, any way? ;-)
Hey! Get to the back of the line! No queue-jumping! I was here first! :-)
Yours
Russ Magee %-)
--~--~-~--~~~---~--~~
You received this messa
On Thu, Sep 06, Russell Keith-Magee wrote:
>
> On 9/6/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
> >
> > I'd *love* to have a sneak preview of your changes, any way? ;-)
>
> Hey! Get to the back of the line! No queue-jumping! I was here first! :-)
... checking Malcolm's Amazone wishlist ..
Michael Radziej skrev:
> On Thu, Sep 06, Russell Keith-Magee wrote:
>
>
>> On 9/6/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
>>
>>> I'd *love* to have a sneak preview of your changes, any way? ;-)
>>>
>> Hey! Get to the back of the line! No queue-jumping! I was here first! :-)
>
On Thu, Sep 06, Nis Jørgensen wrote:
>
> Michael Radziej skrev:
> > On Thu, Sep 06, Russell Keith-Magee wrote:
> >
> >
> >> On 9/6/07, Michael Radziej <[EMAIL PROTECTED]> wrote:
> >>
> >>> I'd *love* to have a sneak preview of your changes, any way? ;-)
> >>>
> >> Hey! Get to the
13 matches
Mail list logo