1👍
✅
You shouldn’t have your model field event
defined as models.CharField
, it should match what you are trying to do in the form. You need to changed it to
events = models.ManyToManyField(Event)
In general you shouldn’t rely on overriding save()
to achieve what you want, there’s a lot going on with the method so it might cause issues. What I suggest is checking the form instead:
# in your views.py
form = ChangeEventTimeForm(request.POST)
if form.is_valid():
# here you would have all events in the form
checked_events = form.cleaned_data['event']
Source:stackexchange.com