Conversation
There was a problem hiding this comment.
Pull request overview
Fixes admin rendering and lookup edge-cases around displaying benefits and resolving related objects.
Changes:
- Ensure
format_html_joinreceives tuples (one per row) when rendering benefits lists. - Fix
format_htmlargument 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) |
There was a problem hiding this comment.
target="_blank" should include rel="noopener noreferrer" to prevent reverse-tabnabbing. Update the anchor HTML to include rel="noopener noreferrer" alongside target="_blank".
| return "---" | ||
|
|
||
| return format_html_join("", "<p>{}</p>", benefits) | ||
| return format_html_join("", "<p>{}</p>", ((b,) for b in benefits)) |
There was a problem hiding this comment.
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.
| return "---" | ||
|
|
||
| return format_html_join("", "<p>{}</p>", benefits) | ||
| return format_html_join("", "<p>{}</p>", ((b,) for b in benefits)) |
There was a problem hiding this comment.
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.
Description
format_html_joingot bare objs andget_related_objectdid a dict lookup instead og.git