Djangoo Foreign key queries

Posted by Hulk on Stack Overflow See other posts from Stack Overflow or by Hulk
Published on 2010-03-27T17:12:08Z Indexed on 2010/03/27 17:13 UTC
Read the original article Hit count: 253

In the following model:

 class header(models.Model):
    title = models.CharField(max_length = 255)
    created_by = models.CharField(max_length = 255)

    def __unicode__(self):
      return self.id()

class criteria(models.Model):
   details =   models.CharField(max_length = 255)
   headerid = models.ForeignKey(header)

   def __unicode__(self):
     return self.id()

class options(models.Model):
 opt_details =   models.CharField(max_length = 255)
 headerid = models.ForeignKey(header)

 def __unicode__(self):
   return self.id()

If there is a row in the database for table header as Id=1, title=value-mart , createdby=CEO

How do i query criteria and options tables to get all the values related to header table id=1

Also can some one please suggest a good link for queries examples,

Thanks..

© Stack Overflow or respective owner

Related posts about django

Related posts about django-views