def index(request): form = EventCreate(request.POST) form.save() return redirect... 

Not specified number date_0, date_1 ... and time_0, time_1 comes to request.POST ...

There are models

 class Event(models.Model): ... class Date(models.Model): event = models.ForeignKey(Event, related_name='dates') 

and there are form

 class EventCreate(forms.ModelForm): dates = ? ... def save(self): instance = super().save() for date in self.dates ... 

The question is how to implement dates, found info about MultiValueField, but there it’s not clear how to work with an uncertain number of fields.

  • In my opinion, you need a FormSet - Alexander
  • @ Alexander did not understand what you are talking about, can you give more details or throw a link to information about it? - Anton

0