Skip to content

fix: bugs in TACC/Core-CMS#1083#1142

Open
wesleyboar wants to merge 4 commits intoTACC:feat/GH-999-let-cms-admin-edit-headerfrom
wesleyboar:fix/GH-999-picture-load-header-content-tags
Open

fix: bugs in TACC/Core-CMS#1083#1142
wesleyboar wants to merge 4 commits intoTACC:feat/GH-999-let-cms-admin-edit-headerfrom
wesleyboar:fix/GH-999-picture-load-header-content-tags

Conversation

@wesleyboar
Copy link
Copy Markdown
Member

@wesleyboar wesleyboar commented Apr 2, 2026

Fix misc. bugs in #1083.

default logo custom logo
edit header - default image edit header - custom logo

The refactor commit 53cfef6 deleted header_logo_tags.py and moved the
header_logo_from_picture tag to header_content_tags.py, but missed
updating the {% load %} tag in the djangocms_picture header_logo template.
This would cause a TemplateSyntaxError when the Picture plugin is rendered
using the 'header_logo' template (e.g. in the header-content placeholder).

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Fix template tag import in djangocms_picture header_logo

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix incorrect template tag import in picture.html
• Update load directive from deleted header_logo_tags to header_content_tags
• Resolve TemplateSyntaxError when rendering Picture plugin with header_logo template
Diagram
flowchart LR
  A["picture.html template"] -->|"load header_logo_tags"| B["❌ TemplateSyntaxError"]
  A -->|"load header_content_tags"| C["✓ Correct tag import"]
Loading

Grey Divider

File Changes

1. taccsite_cms/templates/djangocms_picture/header_logo/picture.html 🐞 Bug fix +1/-1

Update template tag import directive

• Changed template tag import from header_logo_tags to header_content_tags
• Aligns with refactor that moved header_logo_from_picture tag to header_content_tags.py
• Fixes TemplateSyntaxError when Picture plugin renders with header_logo template

taccsite_cms/templates/djangocms_picture/header_logo/picture.html


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Apr 2, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

cursoragent and others added 3 commits April 2, 2026 22:47
Two bugs in header_content_tags.py found during testing:

1. is_picture_plugin used getattr(plugin_type, '__name__', '') but
   get_plugin_instance() returns a plugin class *instance*, not the class
   itself. The instance has no __name__ attribute, so the check always
   returned False. Fixed to use type(plugin_type).__name__.

2. is_remote was hardcoded False, causing remote image URLs from the
   Picture plugin's external_picture/img_src to be passed through
   {% static %}, mangling the URL. Fixed to detect from img_src.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
Static placeholders created by {% static_placeholder %} without the
'site' extra bit are stored with site=None (site_id NULL). The previous
filter used site=request.site (a Site object), which never matched these
placeholders, so get_header_content_parsed always returned no content.

Matches the lookup pattern used by CMS's own StaticPlaceholderNode.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
The custom get_header_content_parsed tag queried the DB directly,
bypassing the CMS renderer. This meant the CMS never registered
the placeholder, so it never appeared in the Structure mode sidebar.

Replace the custom DB query in header.html with the standard
{% static_placeholder 'header-content' or %}...{% endstatic_placeholder %}
pattern (matching footer.html). The 'or' fallback renders the
settings-driven logo when the placeholder is empty.

Plugin rendering is now handled by djangocms_picture/header_logo/picture.html
(already in place), which calls header_logo_from_picture and includes
header_logo.html — the same end result, but through the CMS machinery.

Also remove the PicturePlugin-only restriction from CMS_PLACEHOLDER_CONF
since the custom parsing logic that needed it is gone.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants