#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 |
Description
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
Change History (3)
comment:1 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
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.
Fixed in 75743c1 (https://github.com/django/django/commit/75743c189d5138e47fd139b154c42e3bb67361c8)