AssertionError at /posts/ 'PostList' should either include a `queryset` attribute, or override the `get_queryset()` method
<pre class="lang-py prettyprint-override"><code>ERROR in url==http://127.0.0.1:8000/posts/
 D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\views.py in dispatch

                response = self.handle_exception(exc)

     ...

▶ Local vars
D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\views.py in handle_exception

                self.raise_uncaught_exception(exc)

     ...

▶ Local vars
D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\views.py in dispatch

                response = handler(request, *args, **kwargs)

     ...

▶ Local vars
D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\generics.py in get

            return self.list(request, *args, **kwargs)

     ...

▶ Local vars
D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\mixins.py in list

            queryset = self.filter_queryset(self.get_queryset())

     ...

▶ Local vars
D:\Priyanka_Angular1\virtual_env\django-angular\lib\site-packages\rest_framework\generics.py in get_queryset

                % self.__class__.__name__
</code></pre>
<p><code>serializer.py</code></p>
<pre class="lang-py prettyprint-override"><code>from rest_framework import serializers
from posts.models import Post

class PostSerializer(serializers.HyperlinkedModelSerializer):
    author = serializers.Field(source='author.username')
    api_url = serializers.SerializerMethodField('get_api_url')
 
    class Meta:
        model = Post
        fields = ('id', 'title', 'description', 'created_on', 'author', 'url', 'api_url')
        read_only_fields = ('id', 'created_on')
 
    def get_api_url(self, obj):
         return &quot;#/post/%s&quot; % obj.id
</code></pre>
<p><code>views.py</code></p>
<pre class="lang-py prettyprint-override"><code>from django.shortcuts import render
from rest_framework import generics
from posts.models import Post
from posts.serializers import PostSerializer
 
class PostList(generics.ListCreateAPIView):
  &quot;&quot;&quot;
   List all boards, or create a new board.
  &quot;&quot;&quot;
  model = Post
  serializer_class = PostSerializer
 
 
class PostDetail(generics.RetrieveUpdateDestroyAPIView):
  &quot;&quot;&quot;
   Retrieve, update or delete a board instance.
  &quot;&quot;&quot;
  model = Post
  serializer_class = PostSerializer
</code></pre>