Django admin - inline inlines (or, three model editing at once)

前端 未结 4 1393
北荒
北荒 2020-11-30 18:19

I\'ve got a set of models that look like this:

class Page(models.Model):
    title = models.CharField(max_length=255)

class LinkSection(models.Model):
    p         


        
4条回答
  •  悲哀的现实
    2020-11-30 18:28

    My recommendation would actually be to change your model. Why not have a ForeignKey in Link to LinkSection? Or, if it's not OneToMany, perhaps a ManyToMany field? The admin interface will generate that for free. Of course, I don't recommend this if links don't logically have anything to do with link sections, but maybe they do? If they don't, please explain what the intended organization is. (For example, is 3 links per section fixed or arbitrary?)

提交回复
热议问题