DRF modeltranslation serializer
|
vor 2 Jahren | |
---|---|---|
drf_translated | vor 2 Jahren | |
tests | vor 2 Jahren | |
.gitignore | vor 2 Jahren | |
LICENSE | vor 2 Jahren | |
README.md | vor 2 Jahren | |
requirements.txt | vor 2 Jahren | |
setup.py | vor 2 Jahren |
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 |