Django foreign key error

Posted by Hulk on Stack Overflow See other posts from Stack Overflow or by Hulk
Published on 2010-04-02T11:34:13Z Indexed on 2010/04/02 11:43 UTC
Read the original article Hit count: 459

In models the code is as,

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

In views,

    p_l=header.objects.filter(id=rid)
    for rows in row_data:
     row_query =criteria(details=rows,headerid=p_l)
     row_query.save()

In row_query =criteria(details=rows,headerid=p_l) there is an error saying 'long' object is not callable in models.py in __unicode__,

What is wrong in the code

Thanks..

© Stack Overflow or respective owner

Related posts about django

Related posts about django-views