Django Model Translation with django rest framework not working

245 Views Asked by At

I have successfully implemented models translation and i notice it is working like i can add content in multiple languages from the Django admin but when i implemented in django rest framework, it doesnt work for my expected language, I have successfully sent header for language, translatoin working fine except model translation.

I found this solution: Model translation in Django Rest Framework and I found it is good but not getting how to implement this.

This is my views

class BlogViewSets(ModelViewSet):
    serializer_class = BlogSerializer
    lookup_field = 'slug'


    def get_queryset(self):
        return BlogPage.objects.all()

Can anyone tell me please how can implement this advised solution? Model translation in Django Rest Framework

Not getting any way to implement this.

1

There are 1 best solutions below

1
QuantumaStelata On

Try that:

def get_queryset(self):
    return BlogPage.objects.filter(id__isnull=False)