DRF modeltranslation serializer
Kapustlo e785dc1cab Updated .gitignore | 2 år sedan | |
---|---|---|
drf_translated | 2 år sedan | |
tests | 2 år sedan | |
.gitignore | 2 år sedan | |
LICENSE | 2 år sedan | |
README.md | 2 år sedan | |
requirements.txt | 2 år sedan | |
setup.py | 2 år sedan |
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 |