Closed GoogleCodeExporter closed 9 years ago
I'm also having problems overriding a the save() method of a model that's using
mptt.
The error I'm getting is the following:
ValueError at /admin/myapp/mymodeladd/
Cannot use None as a query value
Here's the traceback:
Environment:
Request Method: POST
Request URL: http://localhost:8000/admin/scrivener/page/add/
Django Version: 1.2 rc 1 SVN-13117
Python Version: 2.6.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.sitemaps',
'mptt',
'filebrowser',
'south',
'haystack',
'django_static',
'etc',
'scrivener',
'gregor',
'annunciator']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "B:\django-apps\3rd Party Source\django\core\handlers\base.py" in
get_response
100. response = callback(request, *callback_args,
**callback_kwargs)
File "B:\django-apps\3rd Party Source\django\contrib\admin\options.py" in
wrapper
239. return self.admin_site.admin_view(view)(*args, **kwargs)
File "B:\django-apps\3rd Party Source\django\utils\decorators.py" in
_wrapped_view
74. response = view_func(request, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\views\decorators\cache.py" in
_wrapped_view_func
69. response = view_func(request, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\contrib\admin\sites.py" in inner
190. return view(request, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\utils\decorators.py" in _wrapper
21. return decorator(bound_func)(*args, **kwargs)
File "B:\django-apps\3rd Party Source\django\utils\decorators.py" in
_wrapped_view
74. response = view_func(request, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\utils\decorators.py" in bound_func
17. return func(self, *args2, **kwargs2)
File "B:\django-apps\3rd Party Source\django\db\transaction.py" in
_commit_on_success
299. res = func(*args, **kw)
File "B:\django-apps\3rd Party Source\django\contrib\admin\options.py" in
add_view
795. self.save_model(request, new_object, form, change=False)
File "B:\django-apps\3rd Party Source\django\contrib\admin\options.py" in
save_model
597. obj.save()
File "B:\django-apps\scrivener\models.py" in save
211. self.url = self.get_absolute_url()
File "B:\django-apps\3rd Party Source\django\utils\functional.py" in _curried
55. return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
File "B:\django-apps\3rd Party Source\django\db\models\base.py" in
get_absolute_url
940. return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label,
opts.module_name), func)(self, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\db\models\__init__.py" in inner
31. bits = func(*args, **kwargs)
File "B:\django-apps\scrivener\models.py" in get_absolute_url
194. for ancestor in self.get_ancestors():
File "B:\django-apps\3rd Party Source\mptt\models.py" in get_ancestors
23. opts.tree_id_attr: getattr(self, opts.tree_id_attr),
File "B:\django-apps\3rd Party Source\django\db\models\manager.py" in filter
141. return self.get_query_set().filter(*args, **kwargs)
File "B:\django-apps\3rd Party Source\django\db\models\query.py" in filter
550. return self._filter_or_exclude(False, *args, **kwargs)
File "B:\django-apps\3rd Party Source\django\db\models\query.py" in
_filter_or_exclude
568. clone.query.add_q(Q(*args, **kwargs))
File "B:\django-apps\3rd Party Source\django\db\models\sql\query.py" in add_q
1131. can_reuse=used_aliases)
File "B:\django-apps\3rd Party Source\django\db\models\sql\query.py" in
add_filter
1000. raise ValueError("Cannot use None as a query value")
Exception Type: ValueError at /admin/scrivener/page/add/
Exception Value: Cannot use None as a query value
Original comment by Saturday...@gmail.com
on 14 May 2010 at 4:51
If I'm not mistaken, the original bug reporter had some issues with
understanding how django-mptt works, but the second comment is a genuine error,
could you test the new release and test if this happens with latest stable
release?
Original comment by matjaz.c...@gmail.com
on 4 Sep 2010 at 1:08
Presumedly the tell-tale bits of that traceback are:
File "B:\django-apps\scrivener\models.py" in save
211. self.url = self.get_absolute_url()
...
File "B:\django-apps\scrivener\models.py" in get_absolute_url
194. for ancestor in self.get_ancestors():
So it looks like self.get_ancestors() is failing on new nodes that haven't been
saved yet?
I tested this in latest master (django 1.1, python 2.6.5, ubuntu 10.04), looks
like it's working as expected now.
If anyone's still having this problem with the latest source checkout, please
comment and we'll reopen
Original comment by craig.ds@gmail.com
on 20 Sep 2010 at 10:24
Original issue reported on code.google.com by
fcat1...@googlemail.com
on 26 Feb 2009 at 9:41