DRF modeltranslation serializer
|
2 anos atrás | |
---|---|---|
drf_translated | 2 anos atrás | |
tests | 2 anos atrás | |
.gitignore | 2 anos atrás | |
LICENSE | 2 anos atrás | |
README.md | 2 anos atrás | |
requirements.txt | 2 anos atrás | |
setup.py | 2 anos atrás |
django-modeltranslation DRF serializers
pip install drf-translated
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 |