My data (spreadsheet):
'1',,,
,'1.1',,
,,'1.1.1',
,,'1.1.2',
,,'1.1.3',
,'1.2',,
,'1.3',,
,,'1.3.1',
,,'1.3.2',
,,'1.3.3',
'2',,,
,'2.1',,
,,'2.1.1',
,,,'2.1.1.1'
,,,'2.1.1.2'
,,,'2.1.1.3'
My model:
class Vocabulary(models.Model):
name = CharField(max_length=60)
class Concept(models.Model):
parent = ForeignKey('self', blank=True, null=True)
vocabulary = ForeignKey(Vocabulary)
name = CharField(max_length=60)
order = IntegerField(default=0)
What I am trying to do:
def recurse(sheet):
'Recurse outer edges of the tree saving concepts.'
+ 'Imply subtree order numbers. There are no numbers in the real data.'