8000 [BUG] AppHook'ed Views can't use placeholders in their templates · Issue #7712 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content
[BUG] AppHook'ed Views can't use placeholders in their templates #7712
Closed
@jrief

Description

@jrief

Description

An AppHook'ed View can't use any CMS placeholders in their templates anymore.

This used to work in CMS version 3.

Steps to reproduce

  • Create an AppHook class and register it
  • Method get_urls of that class returns a list of urlpatterns.
  • The URL attached to the CMS page typically looks like
@apphook_pool.register
class MyApp(CMSApp):
    def get_urls(self, page=None, language=None, **kwargs):
        return [
            ...,
            path('', MyView.as_view()),
            ...,
        ]

Now if the MyView class defines a template and that template contains a CMS {% placeholder … %}-templatetag, then function get_declared_placeholders_for_obj raises an exception.

There is a workaround by populating the toolbar with the current PageContent object, but in my opinion this should be part of the CMS logic and must not be done by the application.

Expected behaviour

No exception and the name placeholder should be editable.

Do you want to help fix this issue?

  • Yes, I want to help fix this issue and I will join #workgroup-pr-review on Slack to confirm with the community that a PR is welcome.
  • No, I only want to report the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0