-
Notifications
You must be signed in to change notification settings - Fork 87
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
Translatable ModelAdmin #550
Translatable ModelAdmin #550
Conversation
Thank you for this @dinoperovic Will aim to get some review time next week. |
@zerolab Yeah I've missed that one. It looks like this could replace some parts of view logic. The views would still need to be overridden to display translation pages etc. Also, to support the previous Wagtail versions. It would be a good idea to align with the approach in the wagtail/wagtail#7857 once it's accepted. I can take a closer look next week. |
cc @kaedroho (in the context of modeladmin/snippets thinking) |
Codecov Report
@@ Coverage Diff @@
## main #550 +/- ##
==========================================
+ Coverage 91.41% 91.66% +0.25%
==========================================
Files 37 42 +5
Lines 3263 3457 +194
Branches 529 557 +28
==========================================
+ Hits 2983 3169 +186
- Misses 161 165 +4
- Partials 119 123 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dinoperovic,
This is a lot of excellent work, thank you.
Left a number of questions and comments.
Additionally, this could really use some documentation
Hey @zerolab, I've made the requested changes, still missing the documentation which I will look to add. |
- used named placeholders for string interpolation - removed re-export of wagtail modeladmin - added more comments in modeladmin views - refactored modeladmin as an optional separate sub-app - moved modeladmin submit view to modeladmin.views - moved tests to modeladmin/tests.py
fc0f36f
to
6005400
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent work, thanks! Just one minor thing I wanted to question
wagtail_localize/templates/wagtail_localize/modeladmin/includes/button.html
Outdated
Show resolved
Hide resolved
Merged. Thank you @dinoperovic. Will make a new release sometime towards the end of the week |
This PR adds support for translating pages and models registered using Wagtail's
modeladmin
.It mostly re-uses the snippets approach and exposes the
TranslatableModelAdmin
class.Translatable ModelAdmin has been a requirement in my personal projects and I have been using a similar setup that works pretty well.
Fixes #291.
A less intrusive approach that I was considering is to release a separate
wagtail-localize-modeladmin
package. Inthis case the snippet views can be "patched" by placing the app above
wagtail.snippets
and handling redirects tomodeladmin
instances when applicable.Curious to hear your thoughts and plans for supporting ModelAdmin localization.