diff --git a/src/webapp/grampsdb/models.py b/src/webapp/grampsdb/models.py index 690b50763..0bc17cb8a 100644 --- a/src/webapp/grampsdb/models.py +++ b/src/webapp/grampsdb/models.py @@ -459,6 +459,16 @@ class PrimaryObject(models.Model): return "/%s/%s" % (self.__class__.__name__.lower(), self.handle) +class PersonFamilyOrder(models.Model): + person = models.ForeignKey("Person") + family = models.ForeignKey("Family") + order = models.PositiveIntegerField(default=1) + +class PersonParentFamilyOrder(models.Model): + person = models.ForeignKey("Person") + family = models.ForeignKey("Family") + order = models.PositiveIntegerField(default=1) + class PersonTag(models.Model): person = models.ForeignKey("Person") tag = models.ForeignKey("Tag") @@ -485,10 +495,11 @@ class Person(PrimaryObject): """ gender_type = models.ForeignKey('GenderType', verbose_name="Gender") probably_alive = models.BooleanField("Probably alive") - families = models.ManyToManyField('Family', blank=True, null=True) + families = models.ManyToManyField('Family', blank=True, null=True, through="PersonFamilyOrder") parent_families = models.ManyToManyField('Family', related_name="parent_families", - blank=True, null=True) + blank=True, null=True, + through='PersonParentFamilyOrder') #addresses = models.ManyToManyField('Address', null=True, blank=True) references = generic.GenericRelation('PersonRef', related_name="refs", content_type_field="object_type",