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

Document TranslatableInlineModelAdmin (and Stacked and Tabular)

Open rasca opened this issue 12 years ago • 4 comments

In the Admin section we should document this classes.

rasca avatar May 19 '12 20:05 rasca

I definitely agree - but I did not have the time to do so yet - if it is something you would be interested in doing, I would love to merge it in.

Kind regards,

Kristian

KristianOellegaard avatar May 20 '12 14:05 KristianOellegaard

:+1: Some examples should be great. I can't even understand how normal TranslatableModel should work. I see the language tabs, but adding a new TranslatableModel in the admin wrting something in the 'Shared Fields' for the first tab and then click on the second tab (another language) will clear all fields and it shouldn't. Only after the first save that's it seems to work more or less. TranslatableInlineModelAdmin (and Stacked and Tabular) I can't figure out how it works. The Inline model shouldn't be the TranslatableModel but the [model]_translations table... I think!? It's just me that needs more input on this? :-(

kimus avatar Jul 16 '13 01:07 kimus

I might be wrong, but I understand from the code that TranslatableInlineModelAdmin intent is to inline translatable models in the admin of another related translatable model instance, the same way it works with Django admin.

Unfortunately I don't use Django admin in my project so I won't be really helpful with that specific part of hvad :(

spectras avatar May 24 '14 23:05 spectras

No change, but for future references, I will address some of the questions of @kimus :

  • About the tabs behavior: The tabs are not actual tabs, they are just tab-themed links. They reload the whole page, dismissing any edited value. If creating a new instance, the whole form is cleared. If editing an existing one, all fields are reloaded from database. Implementing proper tabs would require some javascript and heavier customization of forms. At the moment, the only way to do this is to set up your own form, and use a TranslationFormset along with some custom javascript. I do this in my own projects, maybe I could take some time to implement it in a more generic way for hvad at some point.
  • TranslatableInlineModelAdmin, to the best of my knowledge, is not intended for translation editing, but for editing multiple instances of a translatable model, all of them in only one language. Like, you have an Author admin page where you can edit names and biography in several languages, and you would use TranslatableInlineModelAdmin to inline the admin for Book instances connected to current author.

spectras avatar Oct 20 '14 14:10 spectras