Questions tagged [django-modeltranslation]

The modeltranslation application is used to translate dynamic content of existing Django models to an arbitrary number of languages without having to change the original model classes.

According to official documentation.

Modeltranslation uses a registration approach (comparable to Django’s admin app) to be able to add translations to existing or new projects and is fully integrated into the Django admin backend.

The advantage of a registration approach is the ability to add translations to models on a per-app basis. You can use the same app in different projects, may they use translations or not, and you never have to touch the original model class.

Features

  • Add translations without changing existing models or views
  • Translation fields are stored in the same table (no expensive joins)
  • Supports inherited models (abstract and multi-table inheritance)
  • Handle more than just text fields
  • Django admin integration
  • Flexible fallbacks, auto-population and more!
95 questions
2
votes
1 answer

ModelTranslation, Django Admin and Widgets

I'm using django-modeltranslation to translate one of my model. Everything is fine for now, except that my previous widget isn't working anymore. It tried many things, including this : class EmailTemplateAdmin(admin.ModelAdmin): def…
Depado
  • 4,811
  • 3
  • 41
  • 63
2
votes
2 answers

How to manage properly south migrations for a reusable app using django-modeltranslation?

I have a reusable application. In this app, some models need to be localized and I am using the django-modeltranslation app for it. Using django-modeltranslation cause the south migrations to include the localized field in the model defintion. For…
luc
  • 41,928
  • 25
  • 127
  • 172
1
vote
1 answer

ImportError create_namedtuple_class Django Modeltranslation

I have an error while trying to use django-modeltranslation 0.18.3 in Django 2.2. Here's the end of the traceback: [...] from django.db.models.utils import create_namedtuple_class ImportError: cannot import name 'create_namedtuple_class' from…
sodimel
  • 864
  • 2
  • 11
  • 24
1
vote
0 answers

django-tables2 to used with django-modeltranslation showing all the fields when listed

I am using django-tables2 with django-modeltranslation in one of my new projects. The site is using localization for english and french. If I render the table directly in html everything works fine, but django_tables2 seems to pour everything out,…
jcuot
  • 935
  • 9
  • 24
1
vote
0 answers

Django Multilanguage - allow users to translate their own input

I'm writing a multilanguage application for renting out property. I've succesfully translated all of the static content inside my application, but the input that the user gives is dynamic and needs to be translated by them. Example: The user needs…
1
vote
0 answers

wagtail-modeltranslation Model already contain field

thank you for reading my post. actually my problem is that when migrating from: (wagtail==1.9.1 ; wagtail_modeltranslation==0.6.0rc2) to (wagtail==2.8 ; wagtail-modeltranslation==0.10.17) I get the following error: Watching for file changes with…
1
vote
1 answer

django-modeltranslation: how to disable showing objects (e.g. posts) for the languages that it doesn't have translation?

I am developing a django multilingual app and using django-modeltranslation to translate the models. It works fine except one thing: when translation is not available in a specific language, it still shows the objects (let's say posts). I have some…
Saidmamad
  • 63
  • 1
  • 13
1
vote
2 answers

Invalid syntax error in Django form translate

I try translate my forms.py (placeholder, choices, etc) but i take syntax error. my code is here; from django import forms from django.utils.translation import ugettext_lazy as _ class CreatePollForm(forms.Form): title =…
Aytek
  • 224
  • 4
  • 16
1
vote
1 answer

Wagtail-ModelTranslation Template Fragment Caching

I've implemented a multilingual site using wagtail and wagtail-modeltranslation but I'm having a problem with template fragment caching. The cache works but is not respecting the separate languages. Whichever language is accessed first after a save,…
1
vote
1 answer

language independent query with django-modeltranslation

I currently started to use django-modeltranslation in a Django app and I would like to make a query to retrieve the instance of a model, independent of the language set in the system. For example I have the following model: class…
sknzl
  • 13
  • 1
  • 3
1
vote
1 answer

How do you translate the slug value of a page?

I'm trying to implement a language switcher, for which I'm using the Django recommended form:
{% csrf_token %} {% get_current_language as LANGUAGE_CODE %}
1
vote
0 answers

Copy a field translated with django-modeltranslation to another model instance

I would like to copy a translated field from a model instance var_product of class Product to another model instance var_ordered_product of class OrderedProduct. model.py class Product(OwnedModel): name = models.CharField(max_length=255) class…
1
vote
1 answer

Django modeltranslation too many fields

I want to translate the name field in the django application (1.11) using django-modeltranslation. I want to translate to en and fr, but in the admin panel I get 3 fields instead of two: name, name_en, name_fr. models.py class…
1
vote
0 answers

Django makemigrations continues to detect removing of translated fields

I'm using django 1.10 and django-modeltranslation. I've removed registrations of translated fields for my models and applied sync_translation_fields management command. But now, everytime I run makemigrations, django produce migrations to remove…
BangTheBank
  • 809
  • 3
  • 11
  • 26
1
vote
0 answers

Inheritance for django model Translation

I have a django model class and I applied model translation on that class as described below. I applied translation for some of the model fields. Now if i inherit this model to another model class, then I can not get access to the fields of the…
cjahangir
  • 1,773
  • 18
  • 27