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:
parent
8262134f5d
commit
1f47ab637f
@ -459,6 +459,16 @@ class PrimaryObject(models.Model):
|
|||||||
return "/%s/%s" % (self.__class__.__name__.lower(),
|
return "/%s/%s" % (self.__class__.__name__.lower(),
|
||||||
self.handle)
|
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):
|
class PersonTag(models.Model):
|
||||||
person = models.ForeignKey("Person")
|
person = models.ForeignKey("Person")
|
||||||
tag = models.ForeignKey("Tag")
|
tag = models.ForeignKey("Tag")
|
||||||
@ -485,10 +495,11 @@ class Person(PrimaryObject):
|
|||||||
"""
|
"""
|
||||||
gender_type = models.ForeignKey('GenderType', verbose_name="Gender")
|
gender_type = models.ForeignKey('GenderType', verbose_name="Gender")
|
||||||
probably_alive = models.BooleanField("Probably alive")
|
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',
|
parent_families = models.ManyToManyField('Family',
|
||||||
related_name="parent_families",
|
related_name="parent_families",
|
||||||
blank=True, null=True)
|
blank=True, null=True,
|
||||||
|
through='PersonParentFamilyOrder')
|
||||||
#addresses = models.ManyToManyField('Address', null=True, blank=True)
|
#addresses = models.ManyToManyField('Address', null=True, blank=True)
|
||||||
references = generic.GenericRelation('PersonRef', related_name="refs",
|
references = generic.GenericRelation('PersonRef', related_name="refs",
|
||||||
content_type_field="object_type",
|
content_type_field="object_type",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user