I have Account model in Django.
class Account(models.Model):
name = CharField(max_length=255)
description = CharField(max_length=500)
image_path = CharField(max_length=255)
languages = models.ListField()
Since Django doesn’t have ListField, it gives an error. So how can I store multiple string values (choices will be from settings.LANGUAGES)?
One solution is create a model for
Languagechoices and make a many to many relation withAccountbut that has the disadvantage that the choices have to be put in a database. If you want to use hard coded choices, this is probably not what you want.
There is a django snippet at http://djangosnippets.org/snippets/1200/ that does seem to solve your problem, by implementing a ModelField MultipleChoiceField