title: Cannot query "user": Must be "Model" instance
body: <p>I'm trying to filter users on my private user to user chat, I'm getting the <code>buyer</code>'s username with a model (<code>User</code>) <strong>and</strong> the <code>seller</code>'s username with another model (<code>Profile</code>). </p>
  
  <p>The problem is that I don't understand how I can resolve this issue and why it occurs : </p>
  
  <blockquote>
    <p>ValueError: Cannot query "user_39": Must be "Profile" instance.</p>
  </blockquote>
  
  <p><strong>On my view :</strong></p>
  
  <pre><code>uc = userComment.objects.all().first()
  users = userComment.objects.filter(Q(buyer=uc.buyer) | Q(seller=uc.seller)) #error occurs with this line
  </code></pre>
  
  <p><strong>pdb.set_trace()</strong></p>
  
  <pre><code>(Pdb) uc.seller
  &lt;Profile: user_39&gt;
  (Pdb) uc.buyer
  &lt;User: user_4&gt;
  </code></pre>
  
  <p><strong>Here are my two models.</strong></p>
  
  <pre><code>class Profile(models.Model):
      name = models.CharField(max_length=120)
      user = models.OneToOneField(User, null=True, blank=True)
  
  class userComment(models.Model):
      buyer = models.ForeignKey(User, related_name="buyer", null=True)
      seller = models.ForeignKey(Profile, related_name="seller", null=True)
      sent_at = models.DateTimeField(auto_now_add=True)
      comment = models.TextField(max_length=255, null=True)
  </code></pre>
  
  <p>On my models I don't want to change <code>userComment.seller</code> to <code>ForeignKey(User, ...)</code></p>
  
  <p>How can I resolve this issue ?</p>
  
  <hr>
  
  <p>Full code as requested : </p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def addComment(request, gig_id):
      gig = Gig.objects.get(id=gig_id)
      uc = userComment.objects.all().first()
      users = userComment.objects.filter(Q(Q(buyer=uc.buyer) &amp; Q(seller=uc.seller)) | Q(Q(buyer=uc.seller) &amp; Q(seller=uc.buyer))).order_by('sent_at')
  
      if request.method == 'POST':
          form = userCommentForm(request.POST, request.FILES)
          if form.is_valid():
              form.save(buyer=request.user)
              return HttpResponseRedirect('../' + str(gig.id))
      ...
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class userCommentForm(forms.Form):
      seller = CommaSeparatedUserField(label=_(u"seller"))
      comment = forms.CharField(label=_(u"comment"), widget=forms.Textarea())
  
      def save(self, buyer):
          sellers = self.cleaned_data['seller']
          comment = self.cleaned_data['comment']
          message_list = []
  
          for seller in sellers:
              sl = Profile.objects.get(user=seller) #Connection made here.
              msg = userComment(buyer=buyer, seller=sl, comment=comment,)
              ...
          ...
  </code></pre>
  
  <hr>
  
  <p>PDB Debug </p>
  
  <pre><code>(Pdb) uc = userComment.objects.all().first()
  (Pdb) print('Seller class: %s' % uc.seller.__class__.__name__)
  Seller class: Profile
  (Pdb) users = userComment.objects.filter(buyer_id=uc.buyer_id)
  (Pdb) print(users.count())
  3
  (Pdb) users = userComment.objects.filter(seller_id=uc.seller_id)
  (Pdb) print(users.count())
  4
  (Pdb) users = userComment.objects.filter(Q(seller_id=uc.seller_id) | Q(buyer_id=uc.buyer_id))
  (Pdb) print(users.count())
  4
  (Pdb) users = userComment.objects.filter(buyer=uc.buyer)
  (Pdb) print(users.count())
  3
  (Pdb) users = userComment.objects.filter(seller=uc.seller)
  </code></pre>