Skip to content

Commit beb718a

Browse files
committed
Merge pull request django-cms#1310 from tremmert/develop
Fixes wrong language prefix handling for form actions and admin preview (issue django-cms#1304)
2 parents cfdea7e + 215f02a commit beb718a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cms/middleware/multilingual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def patch_response(content, pages_root, language):
7070
))
7171

7272
content = HREF_URL_FIX_RE.sub(ur'<a\1href=\2/%s%s\5\6\7>' % (language, pages_root), content)
73-
content = FORM_URL_FIX_RE.sub(ur'<form\1action=\2%s%s/\5\6\7>' % (pages_root, language), content).encode("utf8")
73+
content = FORM_URL_FIX_RE.sub(ur'<form\1action=\2/%s%s\5\6\7>' % (language, pages_root), content).encode("utf8")
7474
return content
7575

7676

cms/templatetags/cms_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def preview_link(page, language):
167167
try:
168168
# attempt to retrieve the localized path/slug and return
169169
root = reverse('pages-root')
170-
return root + language + "/" + page.get_absolute_url(language, fallback=False)[len(root):]
170+
return "/" + language + root + page.get_absolute_url(language, fallback=False)[len(root):]
171171
except:
172172
# no localized path/slug. therefore nothing to preview. stay on the same page.
173173
# perhaps the user should be somehow notified for this.

0 commit comments

Comments
 (0)