title: Python Django: "Post.author" must be a "User" instance error
body: <p>I am trying to assign username to author field in Post model ,  Django spews out the following error:</p>
  <blockquote>
  <p>&quot;Post.author&quot; must be a &quot;User&quot; instance.</p>
  </blockquote>
  <p>model:</p>
  <pre><code>class Post(models.Model):
  title = models.CharField(max_length=200)
  image = models.ImageField(upload_to='',null=True,blank=True)
  image_url = models.CharField(max_length=200,default=None,null=True,blank=True)
  date = models.DateTimeField(default=timezone.now)
  content = models.TextField()
  author = models.ForeignKey(User, null=False, blank=False,on_delete=models.CASCADE)
  categories = models.ManyToManyField(Category)
  published = models.BooleanField()
  
  def __str__(self):
      return self.title
  </code></pre>
  <p>view:</p>
  <pre><code>@login_required
  def new_post(request):
     # Add a new post
     if request.method != 'POST':
        # No data submitted, create a blank form
        form = PostForm()
     else:
         # Post data submitted, process data
        form = PostForm(data=request.POST)
        if form.is_valid():
           new_post = form.save(commit=False)
           new_post.author = request.user.username
           new_post.save()
           return redirect('elogs:posts')
     #Display a blank or invalid form
     context = {'form':form}
     return render(request,'elogs/new_post.html',context)
  </code></pre>
  <p>form:</p>
  <pre><code>class PostForm(forms.ModelForm):
  class Meta:
      model = Post
      fields = ['title','content','image','image_url','published']
      widgets = {
          'title': forms.Textarea(attrs={'placeholder': 'Title..'}),
          'content': forms.Textarea(attrs={'placeholder': 'What is on your mind?'}),
          'categories': forms.TextInput()
          
      }
  </code></pre>
  <p>I have solved this error just like this:</p>
  <pre><code>from django.contrib.auth import get_user_model
  author = models.OneToOneField(get_user_model(),on_delete=models.CASCADE)
  </code></pre>