Nested inlines in the Django admin?

后端 未结 5 827
春和景丽
春和景丽 2020-11-28 12:28

Alright, I have a fairly simple design.

class Update(models.Model):
    pub_date = models.DateField()
    title = models.CharField(max_length=512)

class Pos         


        
5条回答
  •  佛祖请我去吃肉
    2020-11-28 13:10

    As of now there is no "built-in" way to have nested inlines (inline inside inline) in django.contrib.admin. Pulling something like this off is possible by having your own ModelAdmin and InlineModelAdmin subclasses that would enable this kind of functionality. See the patches on this ticket http://code.djangoproject.com/ticket/9025 for ideas on how to implement this. You'd also need to provide your own templates that would have nested iteration over both the top level inline and it's child inline.

提交回复
热议问题