-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make end user visible texts for login methods translatable #208
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #208 +/- ##
========================================
Coverage 78.06% 78.07%
========================================
Files 88 88
Lines 3679 3680 +1
========================================
+ Hits 2872 2873 +1
Misses 807 807
Continue to review full report at Codecov.
|
Changing an existing non-translated field to a translated one requires a multi-step process. The translated fields are first created with a different temporary name. Then data is copied from the non-translated fields to the translated fields. The old fields are removed and the translated fields are renamed to have the same name as the original fields had. All this resides in the single migration file in this commit. A few changes were required to an old migration file. 1) The bases needs to include TranslatableModelMixin in the migration where LoginMethod model is first introduced. This is required by Django-parler and how it works internally. django-parler/django-parler#263 (comment) 2) The non-null `name` field requires a default value so that migrating backwards works. The backward migration creates the non-null `name` column which fails unless the column also has a default value.
1d24dd4
to
01764db
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.
Migrations seem to work nicely forwards and backwards. Good job.
It could be nice to group the translated and non-translated fields in the LoginMethodAdmin view like it's done in the services.admin.ServiceAdmin
.
01764db
to
80a122a
Compare
Good idea. Did that. |
Kudos, SonarCloud Quality Gate passed!
|
Django-parler has this documentation for turning a previously non-translated field into a translated one. The problem with that document is, in reality it doesn't work like that.
See commit messages for details how it was solved.