Django foreign key error
- by Hulk
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..