title: ValueError at /issue/1/comment Cannot assign "<SimpleLazyObject: <User: miko>>"
body: <p>So I'm trying to create a simple Comment feature for a blog app. In the Class-based views, if you are using a Foreign Key in your model, I know that you have to override the def form_valid: in order for the Comment to be posted by the current logged-in User.</p>
  <p>I did this for the Blog model in my app, and it works just as intended, however, when I try to do the same with the CommentCreateView, I get the error.</p>
  <p>Here's my code so far</p>
  <p>views.py</p>
  <pre><code>class IssueCreateView(LoginRequiredMixin, CreateView):
      model = Issue
      fields = ['title', 'content', 'mark_as', 'assignee', 'priority', 'label']
  
      def form_valid(self, form):
          form.instance.author = self.request.user
          return super().form_valid(form)
  
  </code></pre>
  <pre><code>class CommentCreateView(LoginRequiredMixin, CreateView):
      model = Comment
      fields = ['title', 'content']
      template_name = 'issues/add_comment.html'
  
      def form_valid(self, form):
          form.instance.issue = self.request.user
          return super().form_valid(form)
  </code></pre>
  <p>models.py</p>
  <pre><code>class Comment(models.Model):
      issue = models.ForeignKey(Issue,
                                on_delete=models.CASCADE, 
                                related_name='comments')
      
      name = models.ForeignKey(User, on_delete=models.CASCADE) 
      title = models.CharField(max_length=100, null=True)
      content = models.TextField()
      date = models.DateTimeField(auto_now_add=True)
      
      def __str__(self):
          return self.title
      def get_absolute_url(self):
          return reverse('issue-detail', kwargs={'pk': self.pk})
  </code></pre>
  <pre><code>class Issue(models.Model):
      title = models.CharField(max_length=100)
      content = models.TextField()
      date_posted = models.DateTimeField(default=timezone.now)
      author = models.ForeignKey(User, on_delete=models.CASCADE)
      
      def __str__(self):
          return self.title
  
  
      def get_absolute_url(self):
          return reverse('issue-detail', kwargs={'pk': self.pk})
  
  </code></pre>
  <p>What did I do wrong?</p>
  <p><a href="https://i.stack.imgur.com/VHRzn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VHRzn.png" alt="enter image description here" /></a></p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\core\handlers\exception.py&quot;, line 47, in inner
      response = get_response(request)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\core\handlers\base.py&quot;, line 181, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\views\generic\base.py&quot;, line 69, in view
      return self.dispatch(request, *args, **kwargs)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\contrib\auth\mixins.py&quot;, line 71, in dispatch
      return super().dispatch(request, *args, **kwargs)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\views\generic\base.py&quot;, line 101, in dispatch
      return handler(request, *args, **kwargs)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\views\generic\edit.py&quot;, line 174, in post
      return super().post(request, *args, **kwargs)
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\views\generic\edit.py&quot;, line 144, in post
      return self.form_valid(form)
    File &quot;C:\Users\mikha\bug_app\issues\views.py&quot;, line 100, in form_valid
      form.instance.issue = self.request.user
    File &quot;C:\Users\mikha\bug_env\lib\site-packages\django\db\models\fields\related_descriptors.py&quot;, line 215, in __set__
      raise ValueError(
  
  Exception Type: ValueError at /issue/1/comment
  Exception Value: Cannot assign &quot;&lt;SimpleLazyObject: &lt;User: miko&gt;&gt;&quot;: &quot;Comment.issue&quot; must be a &quot;Issue&quot; instance.
  </code></pre>