🌐(backend) user language from request Content-Language

We want to adapt the email language depend the website
choosen language. We get the website language
from the request Content-Language header.
We adapt the serializer to set the user language
from the request Content-Language header.
Thanks to that our email will be in the right language.
This commit is contained in:
Anthony LC
2024-08-14 12:25:54 +02:00
committed by Anthony LC
parent ac58341984
commit 41a6ef9dfc
3 changed files with 109 additions and 1 deletions

View File

@@ -262,6 +262,7 @@ class InvitationSerializer(serializers.ModelSerializer):
"Only owners of a document can invite other users as owners."
)
user.language = request.headers.get("Content-Language", "en")
attrs["document_id"] = document_id
attrs["issuer"] = user
return attrs