Description
Description
Non-root AppHook pages or Views that aren't tied to a model with placeholders will fail loudly if their parent template has any placeholders that are rendered with {% placeholder "name" %}
In CMS3 this works fine when inheriting and it just ignores the placeholders, but in CMS4 it breaks because it seemingly tries to render the placeholders. For example in our base:
{% block hero %}
{% placeholder 'hero' %}
{% endblock hero %}
class SomeView(DetailView):
template_name = "app/template.html"
def get_object(self, queryset=None):
return request.user # Something here that doesn't define any placeholders
If we leave this block in our template.html it will attempt to render and break with NoneType should implement get_template
because there's no PageContent or toolbar object.
Steps to reproduce
Steps to reproduce the behavior:
- Create an app with at least 1 non-root view. Make sure there's a
{{ placeholder "name" }}
in the template - Add the app to a page
- Go to the sub-page link
- See error
Expected behaviour
In CMS3 this simply doesn't render the placeholder. The page can load as normal with only the available placeholders
Actual behaviour
In CMS4 this fails loudly with NoneType should implement get_template
Additional information (CMS/Python/Django versions)
Only requires django-cms > 4
Linked issue
Do you want to help fix this issue?
- Yes, I want to help fix this issue and I will join the channel #pr-reviews on the Discord Server to confirm with the community that a PR is welcome.
- No, I only want to report the issue.