首页 > 解决方案 > Is there a way to add ManyToMany filed inside current form (not in popup page) in django admin?

问题描述

I have 2 models in django. the first one is Tag and second one is Article that is related to Tag models via ManyToMany fields.

class Tag(models.Model):
    title = models.CharField(max_length=60, blank=False)

class Article(models.Model):
    title = models.CharField(max_length=160)
    content = models.TextField()
    tags = models.ManyToManyField(Tag)

In Django admin panel, When I want to and one or more tag(s) for an article, a popup appears to add tag. I want to add tags inside the current form. Is it possible?

标签: djangodjango-modelsdjango-admin

解决方案


推荐阅读