I am working on a Family Tree web app, with Django (which I am new to), and am deciding on how to design a FamilyTree class so that Users can be authorized to view/edit certain Trees only.
As it stands, I have two abstract meta classes: Entity and Relation.
Entity can be a Person, or even a Group or Event. Relation can be Parent, Sibling, Partner, etc.
A Relation has "from" and "to" ForeignKeys, each of which maps to one Entity. Because I liked the abstraction better than this suggestion: Family Tree Data Structure, I decided to only store personal information in the Person subclass of Entity. Relations are accessed through "related name". If code is required, please let me know. I'll need permission to post it.
It seems that there are two general ways to design the FamilyTree class:
ManyToOne relations from a FamilyTree instance to all Entities, or all Relations, or both.
OneToOne relation to a root Entity, or Relation, from which the rest of the Tree is unpacked during a session.
I haven't thought of any downsides to the second method, which seems like it would speed things up.
Pros/Cons for both would be greatly appreciated, as well as your personal choice.
Also:
- Django-specific implementation thoughts.
- Maybe assigning permissions based on FamilyTrees alone is not a good idea?
Thanks in advance!