fix: bugs in TACC/Core-CMS#1083#1142
Open
wesleyboar wants to merge 4 commits intoTACC:feat/GH-999-let-cms-admin-edit-headerfrom
Open
fix: bugs in TACC/Core-CMS#1083#1142wesleyboar wants to merge 4 commits intoTACC:feat/GH-999-let-cms-admin-edit-headerfrom
wesleyboar wants to merge 4 commits intoTACC:feat/GH-999-let-cms-admin-edit-headerfrom
Conversation
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>
Review Summary by QodoFix template tag import in djangocms_picture header_logo
WalkthroughsDescription• 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 Diagramflowchart LR
A["picture.html template"] -->|"load header_logo_tags"| B["❌ TemplateSyntaxError"]
A -->|"load header_content_tags"| C["✓ Correct tag import"]
File Changes1. taccsite_cms/templates/djangocms_picture/header_logo/picture.html
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix misc. bugs in #1083.