Caumons
Caumons

Reputation: 9585

Representing ManyToMany relation in Django as two multichoices

I have some many2many fields with a lot of options to choose from and I'd like to have two multichoices for each one, on the left the available options and on the right side the chosen ones. Here is an example that Django does with the Groups.

Groups from Django auth app

I have two questions:

  1. How is this kind of "widged" called?
  2. How can I implement it using Django 1.5.1 in an easy way in order to use it in the frontend and in the backend forms? Is there a native option or a 3rd party app?

Thanks!

Upvotes: 2

Views: 531

Answers (1)

KrzysiekJ
KrzysiekJ

Reputation: 196

This widget is called FilteredSelectMultiple. It can be used in Django admin through filter_horizontal or filter_vertical property of ModelAdmin class. If you want to implement such a widget yourself, perhaps its source code may be helpful.

Upvotes: 2

Related Questions