title: How to dynamically add django objects to a queryset
body: <p>This is my models.py</p>
  <pre><code>class Article(models.Model):
       title = models.CharField(max_length=100) #The title of the article
  
       # This is to count the number of users who have viewed the article
       viewed_user = models.ManyToManyField(User,related_name='viewed_user',blank=True)
  </code></pre>
  <p>I'm trying to add the logic in the views.py in that when a user visits the particular article, if the user is not in the viewed_user list, that user is added there.</p>
  <p>This is what I have tried in the views.py</p>
  <pre><code>    article = get_object_or_4040(Article,id=id)
      if user in article.viewed_user.get_queryset():
          print(&quot;User has already viewed the article&quot;)
      else:
          article.viewed_user.create(user=user) # THrows an error
  </code></pre>
  <p>but I have gotten very many types of errors when I tried, update, create, set, append ....</p>
  <p>Any help would be appreciated THANKS.</p>