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

EmptyPageContent' object has no attribute '_meta' #20

Open
stuaxo opened this issue Apr 29, 2020 · 0 comments
Open

EmptyPageContent' object has no attribute '_meta' #20

stuaxo opened this issue Apr 29, 2020 · 0 comments

Comments

@stuaxo
Copy link

stuaxo commented Apr 29, 2020

Django CMS has a special EmptyPageContent object.
This is not a model instance, and so doesn't have a _meta it will fail as it doesn't have one.

This can come up when pages have been generated programatically and results in a confusing error.

Template error:
In template [snipped]base.html, error at line 126
   'EmptyPageContent' object has no attribute '_meta'   116 :         <script type="text/javascript">
   117 :             var countryCode = "{{ COUNTRY_CODE }}";
   118 :             var countryType = "{{ COUNTRY_TYPE }}";
   119 :         </script>

Traceback:

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  217.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  215.                 response = response.render()

File "/usr/local/lib/python3.6/site-packages/django/template/response.py" in render
  107.             self.content = self.rendered_content

File "/usr/local/lib/python3.6/site-packages/django/template/response.py" in rendered_content
  84.         content = template.render(context, self._request)

File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  207.                     return self._render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render
  154.         return self.render_tag(context, **kwargs)

File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag
  88.         rendered_contents = nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render
  154.         return self.render_tag(context, **kwargs)

File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag
  88.         rendered_contents = nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render
  154.         return self.render_tag(context, **kwargs)

File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag
  88.         rendered_contents = nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render
  154.         return self.render_tag(context, **kwargs)

File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag
  88.         rendered_contents = nodelist.render(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
  990.                 bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
  957.             return self.render(context)

File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render
  154.         return self.render_tag(context, **kwargs)

File "/usr/local/lib/python3.6/site-packages/cms/templatetags/cms_tags.py" in render_tag
  439.             return toolbar.render_with_structure(context, nodelist)

File "/usr/local/lib/python3.6/site-packages/cms/toolbar/toolbar.py" in render_with_structure
  495.         self.populate()

File "/usr/local/lib/python3.6/site-packages/cms/toolbar/toolbar.py" in populate
  435.         self._call_toolbar('populate')

File "/usr/local/lib/python3.6/site-packages/cms/toolbar/toolbar.py" in _call_toolbar
  462.                 getattr(toolbar, func_name)()

File "/usr/local/lib/python3.6/site-packages/djangocms_references/cms_toolbars.py" in populate
  24.         content_type_id = ContentType.objects.get_for_model(obj).pk

File "/usr/local/lib/python3.6/site-packages/django/contrib/contenttypes/models.py" in get_for_model
  43.         opts = self._get_opts(model, for_concrete_model)

File "/usr/local/lib/python3.6/site-packages/django/contrib/contenttypes/models.py" in _get_opts
  30.             model = model._meta.concrete_model

Exception Type: AttributeError at /[snipped]/
Exception Value: 'EmptyPageContent' object has no attribute '_meta'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant