django views question

Posted by Hulk on Stack Overflow See other posts from Stack Overflow or by Hulk
Published on 2010-03-28T08:21:44Z Indexed on 2010/03/28 8:23 UTC
Read the original article Hit count: 695

In my django views i have the following

def create(request):

  query=header.objects.filter(id=a)[0]
  a=query.criteria_set.all()
  logging.debug(a.details)

I get an error saying 'QuerySet' object has no attribute 'details' in the debug statement .What is this error and what should be the correct statemnt to query this.And the model corresponding to this is as follows

where as the models has the following:

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()

Thanks..

© Stack Overflow or respective owner

Related posts about django

Related posts about django-views