Booleanfield and multiple choice?

Trying on the website in the admin to make a multiple choice field, BooleanField.
class School(models.Model):
 ('a', 'A'),
 ('a1', 'A1'),
 ('b', 'B'),
 ('b1', 'B1'),
 ('be', 'BE'),
 ('c', 'C'),
 ('c1', 'C1'),
 ('ce', 'CE'),
 ('c1e', 'C1E'),
 ('d', 'D'),
 ('d1', 'D1'),
 ('de', 'DE'),
 ('d1e', 'D1E'),
 ('e', 'E'),
 ('m', 'M'),
 ('tm', 'TM'),
 ('tb', 'TB'),
 category_education = models.BooleanField(choices=CATEGORY_CHOICES, default=False, verbose_name='Category learning', blank=True)

class SchoolAdminForm(forms.ModelForm):
 class Meta:
 model = School
 widgets = {

 'category_education': CheckboxSelectMultiple(),

 fields = '__all__'

class SchoolAdmin(admin.ModelAdmin):
 form = SchoolAdminForm, SchoolAdmin)

in the end, in the admin panel displays a multiple selection checkboxes, but if any or several and try to save, writes : "Choose the correct option. [u a1'](or choosing) is not among the allowed values." I can not understand in what business.
June 27th 19 at 15:02
1 answer
June 27th 19 at 15:04
Because BooleanField is only True or False. Use JSONField for example, if you have postgresql
As I have missed the point with True and False, thought the tale. But if postgresql does not advise how to implement this? Using advanced model only? - Shawna96 commented on June 27th 19 at 15:07
: Well, the General solution is a ManyToManyField. Else will bother with storing this in a string with delimiters, but have a lot to add, and not the fact that it then side will not work. - Garnett_Deckow commented on June 27th 19 at 15:10
: Got it, thanks for the help. - Shawna96 commented on June 27th 19 at 15:13

Find more questions by tags DjangoPython