[Answered ]-How to save m2m field on Django with commit=False?

2👍

To move forward, I think it’s best to remove the ‘fonts’ field from the form. It does not understand how to process it and you probably are not using the HTML generated for it, given how fonts are transmitted.

Your view code would then be something like this:

def form_valid(self, form):
    obj = form.save()
    for font_id in request.POST.getlist('fonts'):
        obj.font.add(Fonts.objects.get(id=font_id))

Leave a comment