I 'm working on a taxonomie.
These are my models:

class Classificatie(models.Model):
    name=models.CharField(max_length=60)

    def __unicode__(self):
        return self.name

class Taxonomie(models.Model):
    name=models.CharField(max_length=60)
    level=models.ForeignKey(Classificatie)
    parent=models.ForeignKey('self', related_name='parent_id' )
    synoniem=models.ForeignKey('self',
related_name='synoniem_id' ,blank=True, null=True)

I populated the tabels in postgresql

When I do:
>>>Taxonomie.objects.count()
I get the proper number of rows (593)

but when i want to read a single object with:
>>> t=Taxonomie.objects.get(id=20)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python27\lib\site-packages\django\db\models\manager.py",
line 132, in
 get
    return self.get_query_set().get(*args, **kwargs)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line
344, in g
et
    num = len(clone)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line
82, in __
len__
    self._result_cache = list(self.iterator())
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line
286, in i
terator
    obj = model(*row[index_start:aggregate_start])
  File "C:\Python27\lib\site-packages\django\db\models\base.py", line
297, in __
init__
    setattr(self, field.attname, val)
  File "C:\Python27\lib\site-packages\django\db\models\fields
\related.py", line
402, in __set__
    manager.add(*value)
TypeError: add() argument after * must be a sequence, not int


I also tried the Taxonomie model with both ' self ' Foreignkey set to
blank=True and null=True
gives me the same problem. I also can't make new taxonomie objects
with django


What am I doiing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to