Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#18234 closed Bug (fixed)

ValueError attempting to save a flatpage with no sites

Reported by: Karen Tracey Owned by: Karen Tracey
Component: contrib.flatpages Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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.


Request Method: POST
Request URL:

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
Installed Middleware:

File "F:\Py\Python27\lib\site-packages\django\core\handlers\" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "F:\Py\Python27\lib\site-packages\django\contrib\admin\" in wrapper
  366.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\utils\" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\views\decorators\" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\contrib\admin\" in inner
  196.             return view(request, *args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\utils\" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\utils\" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\utils\" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "F:\Py\Python27\lib\site-packages\django\db\" in inner
  209.                 return func(*args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\contrib\admin\" in add_view
  937.             if form.is_valid():
File "F:\Py\Python27\lib\site-packages\django\forms\" in is_valid
  124.         return self.is_bound and not bool(self.errors)
File "F:\Py\Python27\lib\site-packages\django\forms\" in _get_errors
  115.             self.full_clean()
File "F:\Py\Python27\lib\site-packages\django\forms\" in full_clean
  271.         self._clean_form()
File "F:\Py\Python27\lib\site-packages\django\forms\" in _clean_form
  299.             self.cleaned_data = self.clean()
File "F:\Py\Python27\lib\site-packages\django\contrib\flatpages\" in clean
  34.         if same_url.filter(sites__in=sites).exists():
File "F:\Py\Python27\lib\site-packages\django\db\models\" in filter
  621.         return self._filter_or_exclude(False, *args, **kwargs)
File "F:\Py\Python27\lib\site-packages\django\db\models\" in _filter_or_exclude
  639.             clone.query.add_q(Q(*args, **kwargs))
File "F:\Py\Python27\lib\site-packages\django\db\models\sql\" in add_q
  1250.                             can_reuse=used_aliases, force_having=force_having)
File "F:\Py\Python27\lib\site-packages\django\db\models\sql\" 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

Change History (3)

comment:1 Changed 8 years ago by Karen Tracey

Resolution: fixed
Status: newclosed

comment:2 Changed 8 years ago by margusholland

I still get this error in Django 1.4.1

comment:3 Changed 8 years ago by anonymous

It's not a data-loss bug, and it has an easy workaround (specify a site for the flatpage) so the fix was not backported to 1.4 branch.

Note: See TracTickets for help on using tickets.
Back to Top