Django does not create migrations to translate models
See original GitHub issueHi there. I need to translate my site and I decided to use modeltranslation to translate the models. But I have a problem, Django does not see the code to translate and does not create migrations.
My code
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
...
'apps.service',
'modeltranslation',
]
USE_I18N = True
USE_L10N = True
USE_TZ = True
MODELTRANSLATION_DEFAULT_LANGUAGE = 'en'
MODELTRANSLATION_LANGUAGES = ('en', 'uk')
USE_MODELTRANSLATION = True
model.py
class Service(models.Model):
title = models.CharField("Назва сервісу", max_length=200, unique=True)
content = models.TextField("Опис", blank=True, null=True)
short_description = models.CharField("Короткий опис", max_length=250, blank=True, null=True)
translations.py
from .models import Service, Post
from modeltranslation.translator import register, TranslationOptions
@register(Service)
class ServiceTranslationOption(TranslationOptions):
fields = ('title', 'content', 'short_description')
When creating migrations, nothing happens.
$ ./manage.py makemigrations service
No changes detected in app 'service'
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Migrations - Django documentation
Migrations ¶. Migrations are Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your...
Read more >django - makemigrations doesn't detect changes in model
I tried to migrate the changes, but makemigrations doesn't detect the change. It's just the development version, so I can resync (I don't...
Read more >Making Django migrations in Python - LogRocket Blog
Your models in app(s): 'rockets' have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations ......
Read more >Unable to Make existing fields translatable · Issue #263 - GitHub
I am having troubles with Django-Parler 2.0.1 after I had applied migration to translations to make existing fields translatable, it won't show Product ......
Read more >Migrating from django-modeltranslation - Read the Docs
Run ./manage.py migrate to apply the generated data migrations. Your models with translated fields should have a populated i18n field after these migrations....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, i see. Change
translations.py -> translation.py
.I’m stupid. Thank you!