Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/sponsors/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def get_custom_benefits_added_by_user(self, obj):
if not benefits:
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.

@admin.display(description="Removed by User")
def get_custom_benefits_removed_by_user(self, obj):
Expand All @@ -816,7 +816,7 @@ def get_custom_benefits_removed_by_user(self, obj):
if not benefits:
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.

def rollback_to_editing_view(self, request, pk):
"""Delegate to the rollback_to_editing admin view."""
Expand Down Expand Up @@ -1277,7 +1277,7 @@ def get_value(self, obj):
"""Return the asset value, linking to the file URL if applicable."""
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 html

@admin.display(description="Associated with")
Expand All @@ -1289,9 +1289,9 @@ def get_related_object(self, obj):
"""
content_object = None
if obj.from_sponsorship:
content_object = self.all_sponsorships[obj.object_id]
content_object = self.all_sponsorships.get(obj.object_id)
elif obj.from_sponsor:
content_object = self.all_sponsors[obj.object_id]
content_object = self.all_sponsors.get(obj.object_id)

if not content_object: # safety belt
return obj.content_object
Expand Down
Loading