Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tabbed translation admin #109

Closed

Conversation

julianwachholz
Copy link
Contributor

@julianwachholz julianwachholz commented Feb 20, 2024

This change adds simple tabbed UI for translated fields.

Update

This has been released as an independent package django-modeltrans-tabs

Django Admin with tabbed translated fields

Important: The included JavaScript only supports Django 4.2 and up. I think it's a reasonable change as 3.2 is EOL soon (30 April 2024)

See also: #16 (comment)

@julianwachholz
Copy link
Contributor Author

Hi @jieter I added a small test and added the mixin to the example app as well as fixed all pending linter errors.
Do you think this is ready to merge? This Admin integration would be the killer feature for this library I'm certain! :)

@julianwachholz julianwachholz force-pushed the feature-tabbed-admin branch 2 times, most recently from 7918d3a to 81eb41d Compare June 26, 2024 18:11
Copy link
Member

@jieter jieter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the way this works, but I'm a little hesitant because of the amount of code we need to maintain to support it.

I added some superficial comments, I did not attempt to simplify the implementation yet, do you think there is potential to simplify it?

modeltrans/static/modeltrans/css/i18n_tabs.css Outdated Show resolved Hide resolved
modeltrans/static/modeltrans/js/i18n_tabs.js Outdated Show resolved Hide resolved
modeltrans/static/modeltrans/js/i18n_tabs.js Outdated Show resolved Hide resolved
modeltrans/static/modeltrans/js/i18n_tabs.js Show resolved Hide resolved
modeltrans/admin.py Outdated Show resolved Hide resolved
@julianwachholz
Copy link
Contributor Author

Hey @jieter thanks for taking the time to have a look.

I agree with your sentiment that it's some completely new code that will have to be maintained in the future. I tried to keep it minimal using modern JS and no build step. The bulk of the code is required to synchronize the selected languages across all fields and supporting dynamically adding/removing inlines (i.e. fieldsets) in the Django Admin. I feel this sync feature allows for a much better editing experience for content moderators. Removing this feature would indeed get rid of a lot of code, but at the cost of UX.

One thing I thought about it that the Django Admin is by design a very slow moving thing, it has barely changed in the last decade. So keeping up to date with upstream is doable with relatively low effort (and I will gladly step up!).

PS: One thing I haven't mentioned is that the CSS variables referenced also support django-admin-interface

@julianwachholz
Copy link
Contributor Author

@jieter do you have any thoughts?

@julianwachholz
Copy link
Contributor Author

Hey @jieter it's been a while, do you not want to see this in django-modeltrans?

@julianwachholz julianwachholz deleted the feature-tabbed-admin branch October 4, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants