feat(demo_data): use translation override to ensure consistent locale

wraps actions in a `with override("en")` block to enforce the use of the English locale during execution. This ensures consistent behavior and message formatting regardless of the server's default language settings.
This commit is contained in:
Egor Pavlovich Gorbunov 2026-02-27 19:02:55 +03:00
parent a59c5f59dd
commit 79be6ed4e4

View file

@ -10,6 +10,7 @@ from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from django.db import transaction
from django.utils import timezone
from django.utils.translation import override
from engine.blog.models import Post, PostTag
from engine.core.models import (
@ -86,12 +87,13 @@ class Command(BaseCommand):
self._load_demo_data()
if action == "install":
self._install(options)
elif action == "remove":
self._remove()
else:
self.stdout.write(self.style.ERROR(f"Unknown action: {action}"))
with override("en"):
if action == "install":
self._install(options)
elif action == "remove":
self._remove()
else:
self.stdout.write(self.style.ERROR(f"Unknown action: {action}"))
@property
def staff_user(self):