I have created a custom model which will store a list of values for various nodes:

class myModel(models.Model):
    value = models.CharField(max_length=16)
    associate_node = models.ForeignKey(Node)

ie, based on the body of a question I will store some values, such as the names that appear in that question. So my custom model would have the values "Mike" and "John" stored for a question. This way I can search my model to see which questions reference mike or john. However, the same will go for an answer or a comment. Therefore I will be able to search to see if any question, answer, or comment has the reference i'm looking for.

This is fine, but, if I search for my search term I end up with a list of nodes. What I really want is a list of questions whose children have the search term. ie, question x and the answer to question y each contain my search term. I want a list that includes question x and question y when I look for my search term. Is there a simple way to reduce the queryset of nodes to a queryset of questions? I hope this made sense?

asked 08 Mar '11, 21:14

rsp's gravatar image

rsp
41661420
accept rate: 66%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×47
×29
×21
×10
×6

Asked: 08 Mar '11, 21:14

Seen: 292 times

Last updated: 08 Mar '11, 21:14

powered by OSQA