How to show tabularinline data in json api django rest framework?

This is my code, the api only shows the "shorts" data and i want also shows the "subcard" tabularinline data

models.py

class Shorts(models.Model):
shortName = models.CharField(max_length=50,verbose_name='Short name')
video = models.FileField(upload_to='shorts',verbose_name='VideoFile')
short_url = models.URLField(default=False, verbose_name='Short URL')

def __str__(self):
    return self.shortName

class SubCards(models.Model):

sentence = models.CharField(max_length=150, verbose_name='Sentence',default=False)
meaning = models.CharField(max_length=150, verbose_name='meaning',default=False)
parent_card = models.ForeignKey(Shorts,null=True,on_delete=models.CASCADE)
positionCard= models.IntegerField(null=True,verbose_name='positionCard')
skip_to = models.FloatField(null=True,verbose_name='skip video to')
def __str__(self):
    return "subCard"

admin.py

class cartita(admin.TabularInline):
model = SubCards


class subcard(admin.ModelAdmin):
inlines=[cartita]


 admin.site.register(User)
 admin.site.register(Cards)
 admin.site.register(Shorts,subcard)

This view sends the api response

views.py

  class shortView(View):
       @method_decorator(csrf_exempt)
        def dispatch(self, request, *args, 
                                **kwargs):
    return super().dispatch(request, *args, **kwargs)

def get(self, request):
    shorts =  list(Shorts.objects.values())
    if len(shorts) > 0:
        data = {'message':'success','shorts': shorts}
    else:
        data = {'message':'short not found'}
    return JsonResponse(data) 
Back to Top