views:

914

answers:

2

I have a model:

class Company(models.Model):
    name = models.CharField( max_length=100)
    parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
mptt.register(Company, order_insertion_by=['name'])

and

class Financials(models.Model):
    year = models.IntegerField()
    revenue = models.DecimalField(max_digits = 10, decimal_places = 2)

So how can I add Financials as a child to Company in the mptt tree structure?

+1  A: 

I don't quite follow your question. A tree stores one type of object, in your case Company. To link Financials to Company just add a foreign key from Financials to Company.

If this doesn't help please expand your question to give us some more detail about what you are trying to achieve.

Andrew Wilkinson