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 form `clean` method #1456

Merged
merged 1 commit into from Oct 1, 2012
Jump to file or symbol
Failed to load files and symbols.
+1 −1
Diff settings

Always

Just for now

Fix form `clean` method

In cases when current user haven't right to publish current page
`published` key isn't available in `cleaned_data` dictionary
  • Loading branch information...
neoascetic committed Sep 30, 2012
commit b8f9fab04e1576a5dab5ab5b66a1a0045275da3e
View
@@ -116,7 +116,7 @@ def clean(self):
if site and not is_valid_page_slug(page, parent, lang, slug, site):
self._errors['slug'] = ErrorList([_('Another page with this slug already exists')])
del cleaned_data['slug']
if self.cleaned_data['published'] and page.title_set.count():
if self.cleaned_data.get('published') and page.title_set.count():
#Check for titles attached to the page makes sense only because
#AdminFormsTests.test_clean_overwrite_url validates the form with when no page instance available
#Looks like just a theoretical corner case
ProTip! Use n and p to navigate between commits in a pull request.