-
-
Notifications
You must be signed in to change notification settings - Fork 672
fix bug with tuples and get fallback #2954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)) | ||
|
|
||
| @admin.display(description="Removed by User") | ||
| def get_custom_benefits_removed_by_user(self, obj): | ||
|
|
@@ -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)) | ||
|
||
|
|
||
| def rollback_to_editing_view(self, request, pk): | ||
| """Delegate to the rollback_to_editing admin view.""" | ||
|
|
@@ -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) | ||
|
||
| return html | ||
|
|
||
| @admin.display(description="Associated with") | ||
|
|
@@ -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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
format_html_joinwrapping 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.