Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

djangocms-page-sitemap breaks django-cms page types display #67

Closed
fp4code opened this issue Feb 11, 2021 · 1 comment · Fixed by #76
Closed

djangocms-page-sitemap breaks django-cms page types display #67

fp4code opened this issue Feb 11, 2021 · 1 comment · Fixed by #76

Comments

@fp4code
Copy link
Contributor

fp4code commented Feb 11, 2021

Description

After 'djangocms_page_sitemap' is added to INSTALLED_APPS,
page types cannot be displayed

Steps to reproduce

  1. Install a django-cms site
python3 -m venv env
pip install --upgrade pip
pip install wheel
. env/bin/activate
pip install --upgrade pip
pip install wheel
pip install djangocms-installer
djangocms --django-version 2.2 mysite # same problem with 3.1
pip install djangocms-page-sitemap
cd mysite/
./manage.py runserver
  1. Connect as admin/admin
  2. Add a home page
  3. Add the page type "Type 1" with slug "type1"
  4. Display http://localhost:8000/en/page_types/type-1/

That's OK. Now:

  1. Edit mysite/settings.py to add 'djangocms-page-sitemap' to INSTALLED_APPS
  2. Migrate and start server
./manage.py migrate
./manage.py runserver
  1. Try to display the page type http://localhost:8000/en/page_types/type-1/
TypeError at /en/page_types/type-1/

Versions

Python 3.8.6, Django==2.2.18, django-cms==3.8.0, djangocms-page-sitemap==1.0.0

Actual behaviour

Internal Server Error: /en/page_types/type-1/
Traceback (most recent call last):
  File "django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "django/core/handlers/base.py", line 143, in _get_response
    response = response.render()
  File "django/template/response.py", line 106, in render
    self.content = self.rendered_content
  File "/django/template/response.py", line 83, in rendered_content
    content = template.render(context, self._request)
  File "django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "django/template/base.py", line 171, in render
    return self._render(context)
  File "django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "classytags/core.py", line 151, in render
    return self.render_tag(context, **kwargs)
  File "sekizai/templatetags/sekizai_tags.py", line 87, in render_tag
    rendered_contents = nodelist.render(context)
  File "django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "classytags/core.py", line 151, in render
    return self.render_tag(context, **kwargs)
  File "cms/templatetags/cms_tags.py", line 443, in render_tag
    return toolbar.render_with_structure(context, nodelist)
  File "cms/toolbar/toolbar.py", line 467, in render_with_structure
    self.populate()
  File "cms/toolbar/toolbar.py", line 407, in populate
    self._call_toolbar('populate')
  File "cms/toolbar/toolbar.py", line 434, in _call_toolbar
    getattr(toolbar, func_name)()
  File "djangocms_page_sitemap/cms_toolbars.py", line 37, in populate
    position = current_page_menu.find_first(Break, identifier=PAGE_MENU_THIRD_BREAK) - 1
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
[11/Feb/2021 16:02:06] "GET /en/page_types/type-1/ HTTP/1.1" 500 168859
@yakky
Copy link
Member

yakky commented Aug 27, 2022

@fp4code thanks for reporting this issue. It's been fixed with #76 and it will be released soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants