Answer the question
In order to leave comments, you need to log in
How to make the issuance of topics in the selected language?
Hi {{ user.username }}.
I want to make a form with a language picker in the admin panel (I use https://github.com/cordery/django-languages-plus), after selecting a language, issue all objects from my model (which has a connection with Languages)
model:
class Category(models.Model):
name = models.CharField(max_length=255)
class Topic(models.Model):
name = models.CharField(max_length=255)
category = models.ForeignKey(Category)
class LocalizedTopic(models.Model):
topic = models.ForeignKey(Topic)
content = models.CharField(max_length=255)
lang = models.ForeignKey(Language, default='en')
Language: English
1. Привет [Hello] SAVE
2. Как дела? [How are you?] SAVE
3. Хорошо [] SAVE
formfield_for_foreignkey
something useful, but again I don’t know how to apply it, I’m customizing the admin panel for the first time :)
Answer the question
In order to leave comments, you need to log in
You didn't come from that end. You need to remove LocalizedTopic and use django-modeltranslation. Very convenient and well displayed in the admin panel (if grappelli is in the admin panel, then add more grappelli_modeltranslation). If you need to have multilingual versions of the site, then also django-localeurl.
django-rosetta will help to translate static texts (in templates and in source codes). This addition to jang's built-in i18n
django-modeltranslation mechanisms isn't the only option, but it works for me. Maybe you can find something else to suit your needs.
As always, Google drives and pedals.
And more djangopackages.com
Here, for example, on your question:
https://www.djangopackages.com/grids/g/i18n/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question