title: save() prohibited to prevent data loss due to unsaved related object
body: <p>I need to pass a primary key from a newly created <code>ModelForm</code> to another form field in the same view but I get an error. Any suggestions to make this work?
  It looks like in the past, this would be the answer:  </p>
  
  <pre><code>def contact_create(request):
      if request.method == 'POST':
          form = ContactForm(request.POST)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect(reverse(contact_details, args=(form.pk,)))
      else:
          form = ContactForm()
  </code></pre>
  
  <p>From the documentation, this is what is happening in the newer Django version <code>&gt; 1.8.3</code></p>
  
  <blockquote>
    <p>p3 = Place(name='Demon Dogs', address='944 W. Fullerton')
    Restaurant.objects.create(place=p3, serves_hot_dogs=True, serves_pizza=False)<br>
    Traceback (most recent call last):<br>
    ...<br>
    ValueError: save() prohibited to prevent data loss due to unsaved related object 'place'.</p>
  </blockquote>
  
  <p>This is how I am getting my <code>pk</code> from the view:  </p>
  
  <pre><code>my_id = ""
  if form.is_valid():
      # deal with form first to get id
      model_instance = form.save(commit=False)
      model_instance.pub_date= timezone.now()
      model_instance.user= current_user.id
      model_instance.save()
      my_id = model_instance.pk
  
  if hourformset.is_valid():
      hourformset.save(commit=False)
      for product in hourformset:
          if product.is_valid():
              product.save(commit=False)
              product.company =  my_id
              product.save()
  else:
      print(" modelform not saved")
  return HttpResponseRedirect('/bizprofile/success')
  </code></pre>