title: display number of views for each post for a specific author
body: <p>i want to print number of views for a specific post for e.g barack obama = 3 albert einstein = 1 elon musk = 0 that's it,
  but it print multiple values for each entries as you can see in the image.
  so how to achieve this. should i have to use dictionary or what ?
  <a href="https://i.stack.imgur.com/G3Yxi.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>models.py
  class ObjectViewed(models.Model):
      user            =       models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE)
      ip_address      =       models.CharField(max_length=220, blank=True, null=True)
      content_type    =       models.ForeignKey(ContentType, on_delete=models.CASCADE) # User, Blog, or any other models
      object_id       =       models.PositiveIntegerField() # User id, Blog id, or any other models id
      content_object  =       GenericForeignKey('content_type', 'object_id')
      timestamp       =       models.DateTimeField(auto_now_add=True)
  
  views.py
  class PostListView(ListView):
      model = Post
      template_name = 'edmin/post/postList.html'
      context_object_name = 'posts'
      ordering_by = ['-created']
  
      def get_queryset(self):
          post=Post.objects.filter(author=self.request.user)
          return post
  
      def get_context_data(self, *args, **kwargs):
          context = super().get_context_data(*args, **kwargs)
          post=Post.objects.filter(author=self.request.user)
          c_type = ContentType.objects.get_for_model(Post)
          context['count_view'] = [ObjectViewed.objects.filter(content_type=c_type, object_id=p.id) for p in post ]
          print(context['count_view'])
          return context
  
  postList.html
  &lt;table id=&quot;table_id&quot; class=&quot;table display&quot; border='2' align=&quot;center&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;
             &lt;th scope=&quot;col&quot;&gt;#&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Title&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Banner Title&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Created&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Number of Views&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Status&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Edit&lt;/th&gt;
             &lt;th scope=&quot;col&quot;&gt;Delete&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody style=&quot;color:#000&quot;&gt;
          {% for post in posts %}
                {% if post.status == 'Draft' %}
                      
                {% else %}
                     &lt;tr&gt;
                         &lt;th scope=&quot;row&quot;&gt;{{ forloop.counter }}&lt;/th&gt;
                         &lt;td&gt;&lt;a style=&quot;color:blue&quot; href=&quot;{% url 'edmin:post_detail_view' pk=post.pk %}&quot;&gt;{{ post.title }}&lt;/a&gt;&lt;/td&gt;
                         &lt;td&gt;{{ post.banner_title }}&lt;/td&gt;
                         &lt;td&gt;{{ post.created }}&lt;/td&gt;
                         &lt;td&gt;
                            {% for c in count_view %}
                            {{ c|length }}
                            {% endfor %}
                          &lt;/td&gt;
                          &lt;td&gt;{{ post.status }}&lt;/td&gt;
                          &lt;td&gt;&lt;a href=&quot;{% url 'edmin:post_update_view' pk=post.pk %}&quot; class=&quot;btn btn-outline-dark btn-sm&quot;&gt;Edit&lt;/a&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;a href=&quot;&quot; class=&quot;btn btn-outline-danger btn-sm&quot;&gt;Delete&lt;/a&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                  {% endif %}
          {% endfor %}
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>