I'd like the user to be able to make multiple selections via the admin interface, and store the result as a list of comma-separated values. A select-multiple or a list of checkboxes would be great. However, I don't need the items in this list of values to refer to any models in particular... I just want a text list of items, plain and simple, hence I don't think the ManyToManyField is the one I'm looking for. What's the quickest way to do this in Django?
Asked
Active
Viewed 1.5k times
12
-
Possible duplicate of [Django Model MultipleChoice](http://stackoverflow.com/questions/27440861/django-model-multiplechoice) – lechup Aug 16 '16 at 20:20
3 Answers
11
There is a django snippet which does just this: multiple choice model field. It says:
Usually you want to store multiple choices as a manytomany link to another table. Sometimes however it is useful to store them in the model itself. This field implements a model field and an accompanying formfield to store multiple choices as a comma-separated list of values, using the normal CHOICES attribute.

Alexander Torstling
- 18,552
- 7
- 62
- 74
4
Django-multiselectfield does what you require:
https://github.com/goinnn/django-multiselectfield
It's inspired by the snippet that Alexander mentioned.

Mick T
- 377
- 4
- 10
0
This django snippet accomplishes the same with a much smaller footprint.
http://djangosnippets.org/snippets/23/
make sure to update those imports since they are pre version 1.0

jkatzer
- 724
- 7
- 12