title: Create model instance twice from one form
body: <p>I have a page that displays a lesson, which includes a <code>DateTime</code>. The lesson model also has an attribute called <code>lesson_weekly</code>, that is a checkbox that a user selects if they want to repeat the object every week. For example, if the date is set as <code>2019-01-01 10:00 am</code>, and <code>lesson_weekly</code> is checked, I want the <code>lesson</code> object to be duplicated and displayed, but with +7 to the date, so the date would be <code>2019-01-08 10:00</code> am. I believe this can be done by simply adding 7 days to this date, but am unsure how to do it so that it works properly and the date switches to the next month if it passes the last date such as the 30th or 31st. I would appreciate any suggestions in how to do this.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Lesson(models.Model):
      user = models.ForeignKey(User, null=True, default=None, related_name='lessons', on_delete=models.CASCADE)
      lesson_instrument = models.CharField(max_length=255, choices=instrument_list, blank=True)
      lesson_level = models.CharField(max_length=255, choices=level_list, blank=True)
      lesson_length = models.CharField(max_length=255, choices=length_list, blank=True)
      lesson_datetime_start = models.DateTimeField(null=True, blank=True)
      lesson_weekly = models.BooleanField(default=False, blank=True)
  
      def __str__(self):
          return self.lessons
  
      @receiver(post_save, sender=User)
      def create_user_lessons(sender, instance, created, **kwargs):
          if created:
              Lesson.objects.create(user=instance)
  
      @receiver(post_save, sender=User)
      def save_user_lessons(sender, instance, **kwargs):
          for lesson in instance.lessons.all():
              lesson.save()
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class LessonForm(forms.ModelForm):
      lesson_instrument = forms.ChoiceField(choices=instrument_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'}))
      lesson_level = forms.ChoiceField(choices=level_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'}))
      lesson_length = forms.ChoiceField(choices=length_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'}))
      lesson_datetime_start = forms.DateTimeField(input_formats=['%Y-%m-%d %I:%M %p'], widget=forms.DateTimeInput(attrs={'class': 'form-control', 'placeholder':'YYYY-MM-DD Hour:Minute am/pm'}))
      lesson_weekly = forms.BooleanField(required=False)
  
      class Meta:
          model = Lesson
          fields = ('lesson_instrument', 'lesson_level', 'lesson_length', 'lesson_datetime_start', 'lesson_weekly')
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def profile(request, user_id):
      if request.user.is_authenticated and request.user.time_zone:
          activate(request.user.time_zone)
      else:
          deactivate()
  
      lessons = Lesson.objects.filter(user=user_id).order_by('lesson_datetime_start')
      user = User.objects.get(id=user_id)
      form = TeacherProfileForm()
      context = {'form' : form, 'user' : user, 'lessons' : lessons}
      return render(request, 'view/profile.html', context)
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="table-responsive"&gt;
      &lt;table class="table"&gt;
          &lt;tbody&gt;
              {% for lesson in lessons %}
              &lt;tr&gt;
                  &lt;td scope="row"&gt;{{ lesson.lesson_instrument }}&lt;/td&gt;
                  &lt;td&gt;{{ lesson.lesson_level }}&lt;/td&gt;
                  &lt;td&gt;{{ lesson.lesson_length }}&lt;/td&gt;
                  &lt;td&gt;
                      {% load tz %}
                      {% timezone user.time_zone %}
                      {{ lesson.lesson_datetime_start|date}}
                      {% endtimezone %}
                  &lt;/td&gt;
                  &lt;td&gt;{{ lesson.lesson_datetime_start|time}}&lt;/td&gt;
                  &lt;td&gt;$30&lt;/td&gt;
                  &lt;td&gt;
                      &lt;button type="submit" name="submit" class="btn blue_button"&gt;Book now&lt;/button&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              {% endfor %}
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>