Skip to content

fix bug with tuples and get fallback#2954

Merged
JacobCoffee merged 1 commit intomainfrom
fix-sponsors
Mar 5, 2026
Merged

fix bug with tuples and get fallback#2954
JacobCoffee merged 1 commit intomainfrom
fix-sponsors

Conversation

@JacobCoffee
Copy link
Member

Description

  • format_html_join got bare objs and get_related_object did a dict lookup instead og .git

Copilot AI review requested due to automatic review settings March 5, 2026 17:16
@JacobCoffee JacobCoffee merged commit 9386430 into main Mar 5, 2026
1 of 2 checks passed
@JacobCoffee JacobCoffee deleted the fix-sponsors branch March 5, 2026 17:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes admin rendering and lookup edge-cases around displaying benefits and resolving related objects.

Changes:

  • Ensure format_html_join receives tuples (one per row) when rendering benefits lists.
  • Fix format_html argument passing when building a link to an asset URL.
  • Use safe .get() dict access for sponsor/sponsorship lookups with fallback behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

html = obj.value
if obj.value and getattr(obj.value, "url", None):
html = format_html("<a href='{}' target='_blank'>{}</a>", (obj.value.url, obj.value))
html = format_html("<a href='{}' target='_blank'>{}</a>", obj.value.url, obj.value)
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target="_blank" should include rel="noopener noreferrer" to prevent reverse-tabnabbing. Update the anchor HTML to include rel="noopener noreferrer" alongside target="_blank".

Copilot uses AI. Check for mistakes.
return "---"

return format_html_join("", "<p>{}</p>", benefits)
return format_html_join("", "<p>{}</p>", ((b,) for b in benefits))
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same format_html_join wrapping logic is duplicated in two methods. Consider extracting a small helper (e.g., _render_benefits_paragraphs(benefits)) to keep the behavior consistent and reduce duplication.

Copilot uses AI. Check for mistakes.
return "---"

return format_html_join("", "<p>{}</p>", benefits)
return format_html_join("", "<p>{}</p>", ((b,) for b in benefits))
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same format_html_join wrapping logic is duplicated in two methods. Consider extracting a small helper (e.g., _render_benefits_paragraphs(benefits)) to keep the behavior consistent and reduce duplication.

Copilot uses AI. Check for mistakes.
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.

3 participants