N
N
nurzhannogerbek2017-08-31 19:19:36
Django
nurzhannogerbek, 2017-08-31 19:19:36

How to use django-modeltranslation outside of admin?

Hello! Please help me figure it out.
I use django-modeltranslation in my django project . I installed the application, set up the settings.py file , registered the data models as indicated in the docs, but I can’t figure out how to bring the data editing widget out of the admin area. Is it possible to use this application not in the admin panel, and if so, where to start manipulations?
translation.py:

class ArticleTranslationOptions(TranslationOptions):
    """
    Класс настроек интернационализации полей модели Article.
    """
    fields = ('title', 'body',)

translator.register(Article, ArticleTranslationOptions)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nurzhannogerbek, 2017-09-06
@nurzhannogerbek

A bit late, but I'll answer. One of the comments indicated the code. He is a worker. The only problem was that the behavior of the apk itself. It displays the value in the original fields (title and body) depending on the selected user language. For example, if the user has the Russian language specified, then the title field will contain the value from title_ru, if English is selected, then the title field will contain the value from title_en.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question