Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #988 (and made the test slightly better)

  • Loading branch information...
commit 9a28283adbb511ce1bd3e5473197c959ab4cfe72 1 parent e19e994
@ojii ojii authored
Showing with 11 additions and 3 deletions.
  1. +10 −2 cms/models/managers.py
  2. +1 −1  cms/tests/admin.py
View
12 cms/models/managers.py
@@ -188,13 +188,15 @@ def set_or_create(self, request, page, form, language):
base_fields = [
'slug',
'title',
- 'application_urls',
- 'redirect',
'meta_description',
'meta_keywords',
'page_title',
'menu_title'
]
+ advanced_fields = [
+ 'application_urls',
+ 'redirect',
+ ]
cleaned_data = form.cleaned_data
try:
obj = self.get(page=page, language=language)
@@ -210,6 +212,10 @@ def set_or_create(self, request, page, form, language):
if overwrite_url:
data['has_url_overwrite'] = True
data['path'] = overwrite_url
+ for field in advanced_fields:
+ value = cleaned_data.get(field, None)
+ if value:
+ data[field] = value
return self.create(**data)
for name in base_fields:
@@ -219,6 +225,8 @@ def set_or_create(self, request, page, form, language):
overwrite_url = cleaned_data.get('overwrite_url', None)
obj.has_url_overwrite = bool(overwrite_url)
obj.path = overwrite_url
+ for field in advanced_fields:
+ setattr(obj, field, cleaned_data.get(field, None))
obj.save()
return obj
View
2  cms/tests/admin.py
@@ -242,7 +242,7 @@ def test_edit_does_not_reset_apphook(self):
self.assertEqual(page.get_title(), OLD_PAGE_NAME)
self.assertEqual(page.reverse_id, REVERSE_ID)
title = page.get_title_obj()
- self.assertEqual(title.overwrite_url, None)
+ self.assertEqual(title.application_urls, '')
def test_delete(self):
admin = self._get_guys(True)
Please sign in to comment.
Something went wrong with that request. Please try again.