Many-To-Many Fields View on Django Admin

28,264

I believe what you want is a filter_horizontal widget used in the Admin template. This should help: Django Admin ManyToManyField

Share:
28,264
Nameless
Author by

Nameless

Updated on September 11, 2020

Comments

  • Nameless
    Nameless almost 4 years

    Basically I am trying to recreate a fields in this model that is similar to django user authenticate system, for this I try using many-to-many fields but it ended up like this.

    enter image description here

    I am trying to have another field that can show what exist and another field for I have chosen similar to django admin, which looks like this.

    enter image description here

    This is my code

    class Category(models.Model):
        name = models.CharField(max_length=128, unique=True)
    
    class BlogPage(models.Model):
        category = models.ManyToManyField(Category)
        title = models.CharField(max_length=128)
        preview = models.TextField(max_length=256)
        content = models.TextField()