How can I render a ManyToManyField as checkboxes?

class GameForm(forms.ModelForm): 
        name = forms.CharField(max_length=15, label="Name") 
        url = forms.URLField(label="URL", initial="http://") 
        cats = forms.ModelMultipleChoiceField(
            queryset=Category.objects.all(),
            widget=forms.CheckboxSelectMultiple,
            required=True)

        class Meta: 
                model = Game 
                fields = ('name','url','cats')

that should fix your view, but i’m not sure about the admin. still looking… will edit if i find anything.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)