-- Sent from my phone, please excuse any typos. --
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I recommend using django-mptt. I can't link to it cause I'm writing on my phone, but it's easy to find it on Google.
Also, your foreign key should target self rather than Employee, IIRC.
Cheers,
AT
-- Sent from my phone, please excuse any typos. --
--
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
Hi All,
It works by blocking it with the single quote. :)
Thanks for the help.
Cheers,
Setiaman
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/d5YolTy8ZO8J.