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
145
votes
1 answer

How to install a specific version of a package with pip?

I have set up a virtual environment on my server as well as in my local dev environment. On the server, the package django_modeltranslation-0.4.0_beta2 works perfectly fine. However, on my local machine, django_modeltranslation-0.5.0-alpha doesn't…
Houman
  • 64,245
  • 87
  • 278
  • 460
33
votes
6 answers

What's the correct way to set up Django translation?

I've got an issue with translations not working on Django 1.6. I've added this to my settings.py: LANGUAGE_CODE = 'en-us' ugettext = lambda s: s LANGUAGES = ( ('en', ugettext('English')), ('de', ugettext('German')), ) Also added…
frlan
  • 6,950
  • 3
  • 31
  • 72
9
votes
3 answers

Django modeltranslation queries fallback

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…
sabrina
  • 1,567
  • 2
  • 12
  • 15
5
votes
0 answers

How to create a custom serializer for a django rest framework model with translations

I'm using django-rest-framework and I have a model "TextElement" with attribute "text" translated using django-modeltranslation. I need to create a generic serializer that takes translated fields and returns as data a dictionary with language as the…
5
votes
1 answer

Model translation in Django Rest Framework

I'm developing an API with Django Rest Framework, and I'd need some models with a few fields that should support translation in multiple languages then, of course, serializers should have to retrieve the field with the expected language. I've…
5
votes
1 answer

How to solve ORA-22284: duplicate LONG binds are not supported error in django

I am using django with oracle database. I have a model that uses django-modeltranslation. When I add text for more than one language oracle database throws ORA-22284: duplicate LONG binds are not supported error. How can I solve it? I am new to…
Alihaydar Gubatov
  • 988
  • 1
  • 12
  • 27
5
votes
1 answer

django permissions and contenttypes translations

I've been using django-modeltranslation to translate models in django for a while. It is really straightforward and it works really well on apps I've been developing, where all model translated content gets inserted with forms by the final user. eg:…
brunofitas
  • 2,983
  • 1
  • 20
  • 26
4
votes
1 answer

How to index columns created by django-modeltranslation to Elastic, using django-elasticsearch-dsl?

I've translated my Model fields with django-modeltranslation and implemented search using django-elasticsearch-dsl. Problem: django-modeltranslation creates translation fields in DB, and not in my Models, and search is working only for fields…
4
votes
0 answers

Django modeltranslation queries fallback doesn't work

I am using django modeltranslation to build a multi-language site. Slug fields are also translated. Let's consider to have a Page model with a slug field, which is registered for translation. Every Page has an url that ends with its slug. Printing…
3
votes
2 answers

How to get the fieldname of a FileField in the upload_to method, for a field translated with modeltranslation in Django?

I am using django modeltranslation on a FileField. I would like this file to be uploaded in a path /path/to/file//file.ext and I guess the best way is to extract the lang from the fieldname (file_en, file_it, file_fr, ...) where upload_to is…
3
votes
1 answer

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

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 =…
Aytek
  • 224
  • 4
  • 16
3
votes
0 answers

Registering models for translation using django-modeltransltation causes error with MPTTModel

I am using django 2.0.1 with django-modeltranslation 0.12.2 and django-mptt 0.9.0 When I try to register a model for translation that extends MPTTModel I get that error: File "/home/peter/Desktop/dokkanz/listing/urls.py", line 3, in
3
votes
6 answers

Error in db with modeltranslation in django

I want to add internationalization to a project, so I use django-modeltranslation app. However, after following all the steps of configuration and running migrations, when I enter in my admin the model is registered, but when I click on it:…
Elchinas
  • 139
  • 2
  • 8
3
votes
1 answer

Django modeltranslation - can't get and see original fields

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…
Milano
  • 18,048
  • 37
  • 153
  • 353
3
votes
0 answers

django orm how to use values and still work with modeltranslation

I am using django v1.10.2 I am trying to create dynamic reports whereby I store fields and conditions and the main orm model information into database. My code for the generation of the dynamic report is class_object = class_for_name("app.models",…
Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
1
2 3 4 5 6 7