DRF modeltranslation serializer
Kapustlo e785dc1cab Updated .gitignore | il y a 2 ans | |
---|---|---|
drf_translated | il y a 2 ans | |
tests | il y a 2 ans | |
.gitignore | il y a 2 ans | |
LICENSE | il y a 2 ans | |
README.md | il y a 2 ans | |
requirements.txt | il y a 2 ans | |
setup.py | il y a 2 ans |
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 |