﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18234	ValueError attempting to save a flatpage with no sites	Karen Tracey	Karen Tracey	"Reported on django-users. Looks to have been introduced by r16937. No site selection ought to result in an error message on that (required) field, not an exception.

{{{
Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/admin/flatpages/flatpage/add/

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.flatpages')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File ""F:\Py\Python27\lib\site-packages\django\core\handlers\base.py"" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File ""F:\Py\Python27\lib\site-packages\django\contrib\admin\options.py"" in wrapper
  366.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\utils\decorators.py"" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\views\decorators\cache.py"" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\contrib\admin\sites.py"" in inner
  196.             return view(request, *args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\utils\decorators.py"" in _wrapper
  25.             return bound_func(*args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\utils\decorators.py"" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\utils\decorators.py"" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File ""F:\Py\Python27\lib\site-packages\django\db\transaction.py"" in inner
  209.                 return func(*args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\contrib\admin\options.py"" in add_view
  937.             if form.is_valid():
File ""F:\Py\Python27\lib\site-packages\django\forms\forms.py"" in is_valid
  124.         return self.is_bound and not bool(self.errors)
File ""F:\Py\Python27\lib\site-packages\django\forms\forms.py"" in _get_errors
  115.             self.full_clean()
File ""F:\Py\Python27\lib\site-packages\django\forms\forms.py"" in full_clean
  271.         self._clean_form()
File ""F:\Py\Python27\lib\site-packages\django\forms\forms.py"" in _clean_form
  299.             self.cleaned_data = self.clean()
File ""F:\Py\Python27\lib\site-packages\django\contrib\flatpages\forms.py"" in clean
  34.         if same_url.filter(sites__in=sites).exists():
File ""F:\Py\Python27\lib\site-packages\django\db\models\query.py"" in filter
  621.         return self._filter_or_exclude(False, *args, **kwargs)
File ""F:\Py\Python27\lib\site-packages\django\db\models\query.py"" in _filter_or_exclude
  639.             clone.query.add_q(Q(*args, **kwargs))
File ""F:\Py\Python27\lib\site-packages\django\db\models\sql\query.py"" in add_q
  1250.                             can_reuse=used_aliases, force_having=force_having)
File ""F:\Py\Python27\lib\site-packages\django\db\models\sql\query.py"" in add_filter
  1095.                 raise ValueError(""Cannot use None as a query value"")

Exception Type: ValueError at /admin/flatpages/flatpage/add/
Exception Value: Cannot use None as a query value
}}}"	Bug	closed	contrib.flatpages	1.4	Normal	fixed			Accepted	0	0	0	0	0	0
