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

Fix duplicate locale defintion in TranslatableCreateView template #580

Merged
merged 3 commits into from Jun 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% extends "modeladmin/create.html" %}

{% block header %}
{% include "wagtailadmin/shared/header_with_locale_selector.html" with title=view.get_page_title subtitle=view.get_page_subtitle icon=view.header_icon tabbed=1 merged=1 %}
{% include "wagtailadmin/shared/header_with_locale_selector.html" with title=view.get_page_title subtitle=view.get_page_subtitle icon=view.header_icon tabbed=1 merged=1 %}
{% endblock %}

{% block form_action %}{{ view.create_url }}?locale={{ locale.language_code }}{% endblock %}
{% block form_action %}{{ view.create_url }}{% if wagtail_version < "3.0" %}?locale={{ locale.language_code }}{% endif %}{% endblock %}
7 changes: 7 additions & 0 deletions wagtail_localize/modeladmin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def test_create_view(self):
create_url = reverse("wagtail_localize_test_testmodel_modeladmin_create")
response = self.client.get(create_url)

# Check for correct Form Action
self.assertContains(
response,
'<form action="/admin/wagtail_localize_test/testmodel/create/?locale=en"',
)

# Check, if other Language is available in Dropdown
self.assertContains(
response,
'<a href="/admin/wagtail_localize_test/testmodel/create/?locale=de"',
Expand Down