Django Database changes to allow ordered items (families, tags, etc); everything which is import/export is 100% correct

svn: r20101
This commit is contained in:
Doug Blank 2012-07-27 06:37:54 +00:00
parent 8262134f5d
commit 1f47ab637f

View File

@ -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",