1If you save a form with commit=False, you must call the form's save_m2m method to save the many-to-many data. See the docs for more info.
2
3If you decide to use the form_valid method, I would change the following things:
4
5update the instance returned by form.save() and save it, instead of calling form.save() again.
6explicitly call form.save_m2m()
7return a redirect response instead of calling super().form_valid() (which will save the form again)
8Putting that together, you get:
9
10def form_valid(self, form):
11 product = form.save(commit=False)
12 product.user = self.request.user
13 product.location.location = user.user_location
14 product.save()
15 form.save_m2m()
16 return redirect('/success-url/')