【发布时间】:2010-10-05 08:25:37
【问题描述】:
我有一个模型:
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'])
和
class Financials(models.Model):
year = models.IntegerField()
revenue = models.DecimalField(max_digits = 10, decimal_places = 2)
那么如何在 mptt 树结构中将 Financials 作为子级添加到 Company 中?
【问题讨论】:
-
我在这里问了一个类似的问题:stackoverflow.com/questions/291249/…
标签: python django django-models django-mptt