I have a Django application and want to display multiple choice checkboxes in a user\'s profile. They will then be able to select multiple items.
This is a simplifi
You can easily achieve this using ArrayField:
# in my models...
tags = ArrayField(models.CharField(null=True, blank=True, max_length=100, choices=SECTORS_TAGS_CHOICES), blank=True, default=list)
# in my forms...
class MyForm(forms.ModelForm):
class Meta:
model = ModelClass
fields = [..., 'tags', ...]
I use tagsinput JS library to render my tags but you can use whatever you like: This my template for this widget:
{% if not hidelabel and field.label %}{% endif %}
{% if field.help_text %}{{ field.help_text | safe }}{% endif %}