django-modeltrans icon indicating copy to clipboard operation
django-modeltrans copied to clipboard

Could not displayed translated fields when I assign `fields` in ModelAdmin

Open raccoonyy opened this issue 6 years ago • 5 comments

First of all I appreciate to make this lovely library.

Here is my question.

In default settings, I can see all translated fields.

2018-03-26 15 42 22

But when I assign fields in ModelAdmin like this.

class ProgramAdmin(admin.ModelAdmin):
    model = Program

    fields = ('title', ...)

Then, just one field displayed like below.

2018-03-26 15 43 47

raccoonyy avatar Mar 26 '18 06:03 raccoonyy

You don't mention what you expect to see.

The docs have an admin support page, mentioning the ActiveLanguageMixin. It make sure only the default language and the current language are shown. Does that fix your usecase?

jieter avatar Mar 26 '18 15:03 jieter

Oh I missed what I expect to see. Sorry.

I want to assign just title into fieldsets options in ModelAdmin. Then I expect to see translate fields in admin like below.

2018-03-26 15 42 22

Or, would I write all translate fields in fieldsets like this?

fielddsets = (
    ('Basic', {
        'fields': ('title', 'title_en_us', 'title_ko', 'title_zh_hant', 'title_zh_hans')
    }),
)

This is inconvenient way to me. :(

raccoonyy avatar Mar 27 '18 02:03 raccoonyy

I see. Interesting use case. But do you want to show all languages to the user always?

jieter avatar Apr 13 '18 12:04 jieter

Yes I want.

I explain again because my previouse comments are little confused.


When I have title and somethingfields, I assign fieldsets like below.

fieldsets = (
    ('Basic', {
        'fields': ('title', 'something')
    }),
)

Then, Django admin show me fields only title and something. There isn't title_en_us or title_ko.

I want to see all languages fields about title.

raccoonyy avatar Apr 23 '18 03:04 raccoonyy

Had same issue. I solved it by removing ActiveLanguageMixin from my Admin class and using title_i18n in fieldsets.

eriktelepovsky avatar Jun 18 '20 08:06 eriktelepovsky