DRF modeltranslation serializer

Kapustlo e785dc1cab Updated .gitignore %!s(int64=2) %!d(string=hai) anos
drf_translated bbeba8e3b2 Renamed src dir %!s(int64=2) %!d(string=hai) anos
tests bbeba8e3b2 Renamed src dir %!s(int64=2) %!d(string=hai) anos
.gitignore e785dc1cab Updated .gitignore %!s(int64=2) %!d(string=hai) anos
LICENSE 6d04714949 Added license %!s(int64=2) %!d(string=hai) anos
README.md 1b49f59d05 Fixed README.md %!s(int64=2) %!d(string=hai) anos
requirements.txt bad13d9538 Initial commit %!s(int64=2) %!d(string=hai) anos
setup.py b83fe60219 Fixed setup.py %!s(int64=2) %!d(string=hai) anos

README.md

drf-translated

django-modeltranslation DRF serializers

Features

  • Query/context translation support
  • Highly customizable

Installation

pip install drf-translated

Usage

Create a drf_translated.serializers.TranslatedModelSerializer serializer for your registered translation model:

from drf_translated.serializers import TranslatedModelSerializer

class MovieSerializer(TranslatedModelSerializer):
  class Meta:
    model = Movie

    fields = '__all__'

Setting Default Description
DRF_TRANSLATED_QUERY_PARAM language Query language param to convert translated values from dict to str
DRF_TRANSLATED_LOCALE_CONTEXT locale Serializer context key for getting translation language