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
1
vote
0 answers

django-modeltranslation not removing database fields when language is removed

I am using django-modeltranslation to implement localization in my project. I have a model attribute name which support localization. Previously two languages were enabled English and German and the sync_translation_fields command created name_en…
anup raj
  • 11
  • 3
1
vote
0 answers

django modeltranslation removes data

i am having weird trouble translating django-eav fields with model translation. I want to translate EnumValue field value. Code in translations.py Here's class EnumValueTranslationOptions(TranslationOptions): fields = ('value',…
Mažas
  • 387
  • 1
  • 6
  • 19
1
vote
1 answer

Django forms.py initialized wrongly?

I have a django view communicate the user's preferred locale to a form in forms.py. However, that form seems to get initialized before I even call it. Class SurveyForm() seems to load before my call from views.py and even before the SurveyForms()…
Jdruiter
  • 335
  • 2
  • 10
1
vote
2 answers

How to add translation fields in django-taggit?

I am working on multi language web-site. In my apps I am using django modeltranslation to set values on different languages from admin. So how can I add modeltranslation into django-taggit to have a tag on different languages?
belek
  • 907
  • 9
  • 35
1
vote
0 answers

How to translate a SlugField?

I am trying to translate my model using django-modeltranslation and the SlugField is giving me a lot of trouble. I have successfully registered the fields for translation, as you can see in the db table description: …
sogeking
  • 1,216
  • 2
  • 14
  • 45
1
vote
1 answer

django modeltranslation 404

I'm trying to set up my app in two languages, however I'm getting 404 error on all app's urls, even though I've set up another app a while ago the exact same way. models.py: class New(models.Model): title = models.CharField(max_length=300) …
Marijus
  • 4,195
  • 15
  • 52
  • 87
1
vote
1 answer

django-modeltranslation : how to know if the value is defined in a given language?

I am using django-modeltranslation for translation of my content. If the value of a translated field is not set for a language then it automatically takes the value of the default language. However, is there a way to know if value for a given…
luc
  • 41,928
  • 25
  • 127
  • 172
1
vote
2 answers

modeltranslation app doesn't add translated fields in models

I'm new with modeltranslation and I have a problem. When I do the manage.py syncdb command after creating my model and registering the fields to translate in translation.py the modeltranslation app doesn't add the translated field to the model. The…
0
votes
1 answer

How to properly dynamically add ModelForm fields with django-modeltranslation enabled?

I'm attempting to dynamically add translatable fields for my forms.ModelForm, depending on whether the customer has enabled the language or not. However, the translated value isn't saved to the model. from copy import deepcopy from django import…
kunambi
  • 756
  • 1
  • 10
  • 25
0
votes
0 answers

django model-translation, can't filter on multilingual

I'm trying to implement multi-language on my site using django-modeltranslation, but I can't filter product by category when switched to other languages, I'm using Python 3.10.6, Django 4.2, django-modeltranslation 0.18.9 my code: model.py class…
0
votes
0 answers

what is the Error i am getting while training the NMT Model?

When i Try to train my model with the below code: !onmt-main --model_type Transformer --config train_files/config.yml --auto_config train --with_eval Error Screen Shot then facing this error. TypeError: 'NoneType' object is not…
0
votes
0 answers

Django modeltranslation and AutoSlugField

I'm struggling with combination of AutoSlugField (from django-extensions) and ModelTranslation. class Article(models.Model): title = models.CharField(max_length=255, default="") slug = AutoSlugField( populate_from=[ …
user3193620
  • 173
  • 1
  • 11
0
votes
1 answer

How To Automatically Create Objects Of Django Model While Creation Another Model Objects

I Want To Create Object For "ProductOut" Model When "CusOrder" Model Is Being Created Here Is My Code class CusOrder(models.Model): cus_name = models.CharField(max_length=100) cus_number = models.CharField(max_length=11) product =…
0
votes
1 answer

Django Model Translation with django rest framework not working

I have successfully implemented models translation and i notice it is working like i can add content in multiple languages from the Django admin but when i implemented in django rest framework, it doesnt work for my expected language, I have…
0
votes
1 answer

django custom actions interim formpage doesn't submit

Everytime I submit it quits back to model adminpage without executing anything. I'm trying to let there be an interim page for approval purposes. But it either doesn't notice submit or the submit has already happened on page load in other…