-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix duplicate locale defintion in TranslatableCreateView template #580
Conversation
…oing what we want. Quite the opposite: Adding the locale parameter to the URL at this point will result in a malformed URL, which causes a defect of the Create View.
Hey @benmth, thanks for this. Could you please add test for the fix? |
Codecov Report
@@ Coverage Diff @@
## main #580 +/- ##
=======================================
Coverage 91.55% 91.56%
=======================================
Files 47 47
Lines 3898 3899 +1
Branches 592 592
=======================================
+ Hits 3569 3570 +1
+ Misses 186 185 -1
- Partials 143 144 +1
Continue to review full report at Codecov.
|
I tried to replicate the issue locally and cannot, so this most certainly needs test |
Hey @zerolab, i am not very experienced with testing, especially when it comes to Django templates. Due to little time at the moment, a test from me will therefore unfortunately take some time, because I have to get acquainted first, to be able to deliver something useful. |
Hey @zerolab, again, sorry to keep you waiting. I found the time to look at it today and was able to expand the tests accordingly. In doing so, I then also extended the original change to respect Wagtail installations below version 3.0. If there is still something to do from my side, please just let me know. |
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.
Nice on @benmth!
version 1.2.1 is now out |
This PR fixes #579, as it removes the duplicate definition of the "locale" parameter.
The "?locale=" parameter is already attached to the URL in the base template ("modeladmin/create.html"):
{% block form_action %}{{ view.create_url }}{% endblock %}{% if locale %}?locale={{ locale.language_code }}{% endif %}
As a result, it is currently not necessary to override the "form_action" block.
Removing the code ensures that the CreateView works again, and does not fail because of a malformed URL, ending in a 404 error.