Hi,

I want to implement hierarchy data model which is quite common in
Relational Data Model.

Let's say I have Employee model which has the relation to the boss which
link to the employee model itself.
It will look like this:

class Employee(models.Model):
    empname = models.CharField(max_length=60)
    boss = models.ForeignKey(Employee)
    salary = models.integer()


Sample Data:

ID    empname      boss        salary
--------------------------------------------------
1      albert            null          10000
2      bert              1              5000
3      Chuck          1              5000
4      Donna          3              3000
5      Jack            3              2000

Albert is the root with Bert and Chuck under him and Chuck has Donna and
Jack under him.

I got an error when I tried to sync to the database where Django telling me
that the employee is not exist in the Foreign key part.
Is there any way to manipulate this situation?

Cheers,
Setiaman

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