AttributeError: 'NoneType' object has no attribute 'is_descendant_of'
See original GitHub issueI know, that similar issue was marked as solved few months ago, but I am experiencing this issue now again when using postgres.
Summary
I always get unhandled exeption when creating subpage or when moving some page under another one. It only happens with postgres.
Steps to reproduce
- create basic django-cms project following the how to
- set up the database connection to use postgresql database (Fedora 25, Postgresql 9.5)
- create page “Home” in the admin (BTW, the wizzard, which appears, if there is no page, doesn’t work, as I can’t select the “Create page”)
- try to create subpage of the page created in previous step
Internal Server Error: /admin/cms/page/add/
Traceback (most recent call last):
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/contrib/admin/options.py", line 541, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 244, in inner
return view(request, *args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/cms/admin/pageadmin.py", line 374, in add_view
return super(PageAdmin, self).add_view(request, form_url, extra_context=extra_context)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1437, in add_view
return self.changeform_view(request, None, form_url, extra_context)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/utils/decorators.py", line 184, in inner
return func(*args, **kwargs)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1378, in changeform_view
self.save_model(request, new_object, form, not add)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/cms/admin/pageadmin.py", line 167, in save_model
obj = obj.move(target, pos=position)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/cms/models/pagemodel.py", line 1450, in move
super(Page, self).move(target, pos)
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/treebeard/mp_tree.py", line 1046, in move
return MP_MoveHandler(self, target, pos).process()
File "/home/misli/testcms/django-cms-site/lib/python2.7/site-packages/treebeard/mp_tree.py", line 444, in process
if self.target.is_descendant_of(self.node):
AttributeError: 'NoneType' object has no attribute 'is_descendant_of'
Environment
- Python version: 2.7.13
- Django version: 1.9.12
- django CMS version: 3.4.2
appdirs==1.4.2
Django==1.9.12
django-classy-tags==0.8.0
django-cms==3.4.2
django-formtools==2.0
django-sekizai==0.10.0
django-treebeard==4.1.0
djangocms-admin-style==1.2.6.2
packaging==16.8
psycopg2==2.6.2
pyparsing==2.1.10
six==1.10.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Why do I get AttributeError: 'NoneType' object has no attribute ...
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .
Read more >AttributeError: 'NoneType' object has no attribute 'viewport' #108
Often semshi throws an error when vim gets resized. It might be a conflict with other plugins installed, but it sometimes happens. No...
Read more >AttributeError: 'NoneType' object has no attribute 'AsValueString
Trying to create a simple script but getting this error. Don't understand why because i can clearly see the value in it. “AttributeError: ......
Read more >AttributeError: 'NoneType' object has no attribute 'pop'
AttributeError means that there was an Error that had to do with an Attribute request. In general, when you write x.y, y is...
Read more >AttributeError: 'NoneType' object has no attribute 'getReleases'
Hi there, I am currently trying to get my experiment to integrate with our Biopac shock hardware via parallel port. I am running...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, it took me some time, but I have finally found it. As I have written in the previous comment, the collation matters. You haven’t encountered this issue, as You probably use
en_US.UTF-8
as default collation. But for different locales the default collation is also different. On system with system default locale for example (my case)cs_CZ.UTF-8
the commandsu - postgres -c "createdb test"
creates database as following:It is not wrong. I want all the names, titles, etc. to be sorted correctly (
č
betweenc
andd
,ch
betweenh
andi
, etc.), but in case ofpublic.cms_page.path
the collation should always ensure that0
is lower thanA
. Therefore i’d suggest to always use “C”. I’ll create an issue for treebeard, but some note in django-cms documentation would also be nice.Unfortunately, the result is the same even using the installer. Both creating a subpage or moving a page under another one fails. I’ll try to investigate, why it is happening.