我有三个django模型,我想在订单页面上编辑项目的实例。有可能吗?
#models.py
class Item(models.Model):
name = models.CharField(max_length = 128)
cart = models.ForeignKey('Cart')
class Cart(models.Model):
number = models.IntegerField()
class Order(models.Model):
cart = models.OneToOneField('Cart')
#admin.py
ItemInline(admin.TabularInline):
model = Item
CartInline(admin.TabularInline):
model = Cart
Order(ModelAdmin):
inlines = (CartInline,) # I need ItemInline here...
答案 0 :(得分:0)
这样做订单是推车的内联,而不是反过来?