[Fixed]-How can I create this kind of filter box for a certain field in admin pages? django

1👍

This is auto generate form input when there is manytoMany relation in your model.

Fox ex, something like this.

class Team(models.Model):
    members= models.ManyToManyField(Employee)

In you admin.py you have to register your model to show in admin pages.

class TeamAdmin(admin.ModelAdmin):
    filter_horizontal = ('employees',)


admin.site.register(Team, TeamAdmin)

There is more evolved selection also possibly with some customisation.

Leave a comment