django-modeltranslation

Wagtail modeltranslation doesn't work with DEBUG = False

余生长醉 提交于 2021-02-11 13:27:55
问题 I have a problem with absent redirection to the default language for the multilanguage wagtail site. If I set DEBUG = False on production, I got Internal server error , because redirection to url with language postfix is absent. If DEBUG = True everything works fine. I'm using wagtail_modeltranslation https://progtribe.com/ - doesn't work https://progtribe.com/uk - works I use Wagtail, Gunicorn, Nginx In my error logs I see only This log from gunicorn: If I set DEBUG = True then I get 302

Wagtail modeltranslation doesn't work with DEBUG = False

帅比萌擦擦* 提交于 2021-02-11 13:26:32
问题 I have a problem with absent redirection to the default language for the multilanguage wagtail site. If I set DEBUG = False on production, I got Internal server error , because redirection to url with language postfix is absent. If DEBUG = True everything works fine. I'm using wagtail_modeltranslation https://progtribe.com/ - doesn't work https://progtribe.com/uk - works I use Wagtail, Gunicorn, Nginx In my error logs I see only This log from gunicorn: If I set DEBUG = True then I get 302

How do you translate the slug value of a page?

旧街凉风 提交于 2021-02-10 23:32:22
问题 I'm trying to implement a language switcher, for which I'm using the Django recommended form: <form action="{% url 'set_language' %}" method="post">{% csrf_token %} {% get_current_language as LANGUAGE_CODE %} <input name="next" type="hidden" value="{{ redirect_to }}"> <input name="language" type="hidden" value="{% if LANGUAGE_CODE == 'en' %}es{% else %}en{% endif %}"> </form> My urls.py is set up like so: urlpatterns = [ # Wagtail urls re_path(r'^cms/', include(wagtailadmin_urls)), re_path(r'

How do you translate the slug value of a page?

北慕城南 提交于 2021-02-10 23:30:22
问题 I'm trying to implement a language switcher, for which I'm using the Django recommended form: <form action="{% url 'set_language' %}" method="post">{% csrf_token %} {% get_current_language as LANGUAGE_CODE %} <input name="next" type="hidden" value="{{ redirect_to }}"> <input name="language" type="hidden" value="{% if LANGUAGE_CODE == 'en' %}es{% else %}en{% endif %}"> </form> My urls.py is set up like so: urlpatterns = [ # Wagtail urls re_path(r'^cms/', include(wagtailadmin_urls)), re_path(r'

Django modeltranslation slug problem. When i change language dont go right url

好久不见. 提交于 2021-01-28 14:50:27
问题 modeltranslation... i change title, content and slug sections on my translation.py. Everything work is fine but i have a problem. let me try to explain; i have one post in my website and this post "slug" like this; slug_en = some_en_slug slug_fr = some_fr_slug And i have one language changer on my navbar. {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} <form action="{% url "set_language" %}" method=

Django modeltranslation slug problem. When i change language dont go right url

为君一笑 提交于 2021-01-28 14:31:18
问题 modeltranslation... i change title, content and slug sections on my translation.py. Everything work is fine but i have a problem. let me try to explain; i have one post in my website and this post "slug" like this; slug_en = some_en_slug slug_fr = some_fr_slug And i have one language changer on my navbar. {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} <form action="{% url "set_language" %}" method=

Django Rest Framework and Django-Hvad

久未见 提交于 2020-01-02 11:22:31
问题 so i needed to had some model-translation support for my DRF API and i started using django-hvad. It seems to work well with my django application but i am getting some issues with the DRF APi. I am trying to create a simple POST request and i am getting a error: Accessing a translated field requires that the instance has a translation loaded, or a valid translation in current language (en) loadable from the database Here are my models, serializers and viewsets: Model: class Mission

Django modeltranslation queries fallback

别说谁变了你拦得住时间么 提交于 2019-12-31 01:43:38
问题 I'm using django modeltranslation for a multi-language site. Language fallback works good when reading attributes directly. For example, if current language is German and I print object.title, if the German title is not defined I'll see the english title. I would expect fallback to work also on queries, but that's not true. In fact, if i do something like results = MyModel.objects.filter(title = 'hello') this will get no results if the German title is not set, while I would like it to return

Django modeltranslation - can't get and see original fields

断了今生、忘了曾经 提交于 2019-12-08 11:29:36
问题 I'm trying to use django-modeltranslation in my project. For now, just for Tag model with one field - name . I've created and registered TranslationOptions , then makemigrations and migrate . Now I can't access the original name text. It seems to be replaced with '' (empty string) but it isn't: In [6]: Tag.objects.first() Out[6]: <Tag: > In [7]: Tag.objects.first().name Out[7]: u'' In [8]: Tag.objects.first().__dict__ Out[8]: {'_state': <django.db.models.base.ModelState at 0x7fc96ad41710>,

django-modelstranslation fallback original field value

☆樱花仙子☆ 提交于 2019-12-07 17:49:11
问题 I have a big Django application that is actively used by internet users. I am trying to add django-modeltranslation to one of my apps. In development everything works alright with the following procedure: Install django-modeltranslation and do the proper model changes. Create the South migration for it python manage.py schemamigration myapp --auto Apply the migration python manage.py migrate myapp Run django-modeltranslation management command to populate default language from original field