python - Wagtail 0.8.6 - admin - NoneType' object has no attribute 'allowed_subpage_types' -


i'm using wagtail 0.8.6 django 1.7.7, when try access specific page in admin:

http://127.0.0.1:8020/admin/pages/4/ 

i following error:

attributeerror @ /admin/pages/4/ 'nonetype' object has no attribute 'allowed_subpage_types' 

this traceback:

environment:   request method: request url: http://127.0.0.1:8020/admin/pages/4/  django version: 1.7.7 python version: 2.7.3 installed applications: ('django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'raven.contrib.django.raven_compat',  'compressor',  'taggit',  'modelcluster',  'django.contrib.admin',  'preventconcurrentlogins',  'django_medusa',  'wagtail.wagtailcore',  'wagtail.wagtailadmin',  'wagtail.wagtaildocs',  'wagtail.wagtailsnippets',  'wagtail.wagtailusers',  'wagtail.wagtailimages',  'wagtail.wagtailembeds',  'wagtail.wagtailsearch',  'wagtail.wagtailredirects',  'wagtail.contrib.wagtailmedusa',  'myapp',  'django_extensions') 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.middleware.clickjacking.xframeoptionsmiddleware',  'preventconcurrentlogins.middleware.preventconcurrentloginsmiddleware',  'wagtail.wagtailcore.middleware.sitemiddleware',  'wagtail.wagtailredirects.middleware.redirectmiddleware')   template error: in template /home/vagrant/venv/local/lib/python2.7/site-packages/wagtail/wagtailadmin/templates/wagtailadmin/pages/list.html, error @ line 265    'nonetype' object has no attribute 'allowed_subpage_types'    255 :                         {% if allow_navigation %}      256 :                             {% if moving %}      257 :                                 {% if page.can_descend %}      258 :                                     <a href="{% url 'wagtailadmin_pages_move_choose_destination' page_to_move.id page.id %}" class="icon text-replace icon-arrow-right navigate-pages" title="{% blocktrans title=page.title %}explorer subpages of '{{ title }}'{% endblocktrans %}">{% trans 'explore' %}</a>      259 :                                 {% endif %}      260 :                             {% elif choosing %}      261 :                                 {% if page.can_descend %}      262 :                                     <a href="{% url 'wagtailadmin_choose_page_child' page.id %}?{{ querystring }}" class="icon text-replace icon-arrow-right navigate-pages" title="{% blocktrans title=page.title %}explorer subpages of '{{ title }}'{% endblocktrans %}">{% trans 'explore' %}</a>      263 :                                 {% endif %}      264 :                             {% else %}      265 :                                  {% if page.is_navigable %}       266 :                                     <a href="{% url 'wagtailadmin_explore' page.id %}" class="icon text-replace icon-arrow-right" title="{% blocktrans title=page.title %}explore child pages of '{{ title }}'{% endblocktrans %}">{% trans "explore" %}</a>      267 :                                 {% elif page_perms.can_add_subpage %}      268 :                                     <a href="{% url 'wagtailadmin_pages_add_subpage' page.id %}" class="icon text-replace icon-plus-inverse" title="{% blocktrans title=page.title %}add child page '{{ title }}'{% endblocktrans %}">{% trans 'add subpage' %}</a>      269 :                                 {% endif %}      270 :                             {% endif %}      271 :                         {% endif %}      272 :                      </td>      273 :                 </tr>      274 :             {% endfor %}      275 :         {% else %}   traceback: file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response   111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view   21.                 return view_func(request, *args, **kwargs) file "/home/vagrant/venv/local/lib/python2.7/site-packages/wagtail/wagtailadmin/views/pages.py" in index   65.         'pages': pages, file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/shortcuts.py" in render   50.     return httpresponse(loader.render_to_string(*args, **kwargs), file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string   178.         return t.render(context_instance) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   148.             return self._render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _render   142.         return self.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   126.         return compiled_parent._render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _render   142.         return self.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   126.         return compiled_parent._render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _render   142.         return self.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   126.         return compiled_parent._render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _render   142.         return self.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   65.                 result = block.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   65.                 result = block.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render   150.                 return template.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   148.             return self._render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _render   142.         return self.nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render   312.                 return nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render   201.                             nodelist.append(node.render(context)) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render   312.                 return nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render   312.                 return nodelist.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in render   844.                 bit = self.render_node(node, context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node   80.             return node.render(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render   305.                     match = condition.eval(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/defaulttags.py" in eval   898.         return self.value.resolve(context, ignore_failures=true) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in resolve   596.                 obj = self.var.resolve(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in resolve   734.             value = self._resolve_lookup(context) file "/home/vagrant/venv/local/lib/python2.7/site-packages/django/template/base.py" in _resolve_lookup   788.                             current = current() file "/home/vagrant/venv/local/lib/python2.7/site-packages/wagtail/wagtailcore/models.py" in can_add_subpage   1269.         if not self.page.specific_class.allowed_subpage_types():  # page model has empty subpage_types list, no subpages allowed  exception type: attributeerror @ /admin/pages/4/ exception value: 'nonetype' object has no attribute 'allowed_subpage_types' 

before upgrade, wagtail 0.5 , django 1.6.5 working. idea of can cause that?

i hit bug today well.

i found line of code in wagtailcore models.py file , added print statement narrow down page causing issue.

def can_add_subpage(self):    print self 

from there checked wagtailcore_page table in database , found specific page. in case pointing content type model no longer being used , updated database accordingly.

you can test out in shell.

from wagtail.wagtailcore.models import page pages = page.objects.all() p in pages:     if not p.specific_class:         print p 

i've seen happen in cms's, create page of type , and delete/rename model old data stays in page tree. try make sure have deleted content types in cms first, before removing code.

hopefully point in right direction. wagtail on.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -