title: "Cannot force an update in save() with no primary key"- when submitting an edit/update form
body: <p>I have an edit form that I only want to update the "title", "content", and "category" of a Post. To this end, I have included <code>update_fields</code> when saving the form. However, there's a wee issue with this. Django raises a ValueError (specifically "Cannot force an update in save() with no primary key") when I submit the form. Why is it doing this, and how can I fix this?</p>
  
  <p>Post form:</p>
  
  <pre><code>class PostForm(forms.ModelForm):
  
      def __init__(self,  *args, **kwargs):
          super().__init__(*args, **kwargs)
          for key in ['postTitle', 'postContent', 'category']:
              self.fields[key].widget.attrs.update({'class': 'form-control'})         
          self.fields['content'].widget.attrs.update(width='100px', height='50')
  
      class Meta:
          model = Post
          fields = ('title', 'content', 'category') 
  </code></pre>
  
  <p>Post model:</p>
  
  <pre><code>class Post(models.Model):
      title = models.CharField(max_length = 100)
      URL = models.SlugField() # slug for url 
      content = models.TextField()
      author = models.ForeignKey(User, on_delete = models.CASCADE, related_name = 'posts') # id of author
      category = models.CharField(max_length = 9, default = 'General') # category the post is in
      creationDate = models.DateTimeField()
  </code></pre>
  
  <p>Edit view:</p>
  
  <pre><code>def editPost(request, pk):
      if request.method == 'GET':
          post = get_object_or_404(Post, pk = pk)
          if post.author == request.user:
              form = PostForm(instance = post)
              return render(request, 'editPost.html',  {'form': form, 'post': post})
          else:
              return redirect('viewPost', pk = pk, postURL = post.postURL)
      if request.method == 'POST':
          post = get_object_or_404(Post, pk = pk)
          form = PostForm(request.POST)
          if post.author == request.user:
              if form.is_valid():
                  post = form.save(commit=False)
                  post.URL = slugify(post.postTitle)
                  post.save(update_fields = ['title', 'content', 'category', 'postURL'])
      return redirect('viewAll')
  </code></pre>