Django serializer returns empty list

I have a class-based view that returns all the data in the table. But while accessing the URL all I get is an empty list.

from django.db import models

class EmployeeModel(models.Model):
    EmpID = models.IntegerField(primary_key=True)
    EmpName = models.CharField(max_length=100)
    Email = models.CharField(max_length=100)
    Salary = models.FloatField()

    class Meta:
        verbose_name = 'employeetable'

from rest_framework.views import APIView
from rest_framework.response import Response
from .models import EmployeeModel
from .serializers import EmployeeSerialize

class EmployeeTable(APIView):

    def get(self,request):
        emp_obj = EmployeeModel.objects.all()
        empserializer = EmployeeSerialize(emp_obj,many=True)
        return Response(

from rest_framework import serializers
from .models import EmployeeModel

class EmployeeSerialize(serializers.ModelSerializer):
    class Meta:
        model = EmployeeModel
        fields = '__all__'

from django.contrib import admin
from django.urls import path, include
from .views import EmployeeTable, transformer_list

urlpatterns = [

The table has 5 rows. It is not empty. I want to serialize all 5 rows

I have also created the same but in my case, it worked see the below images

enter image description here

See my serializer

enter image description here

See my models below

enter image description here

and my output is here below

enter image description here

I think there are some issue at your code or some mistake can be there can you please provide full information

Back to Top