Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions apps/sponsors/models/benefits.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ def user_edit_url(self):
@property
def user_view_url(self):
"""Return the URL for sponsors to view this provided asset."""
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

user_view_url’s docstring says it returns a URL to view this provided asset, but the implementation now links to the sponsorship detail page’s provided-assets section and no longer encodes which asset is being referenced. Either update the docstring (and/or property name) to reflect the new behavior, or add a per-asset deep link (e.g., an element id per asset) so the URL can still target a specific asset.

Suggested change
"""Return the URL for sponsors to view this provided asset."""
"""Return the URL for sponsors to view the sponsorship's provided assets section."""

Copilot uses AI. Check for mistakes.
url = reverse("users:view_provided_sponsorship_assets", args=[self.sponsor_benefit.sponsorship.pk])
return url + f"?provided_asset={self.pk}"
url = reverse("users:sponsorship_application_detail", args=[self.sponsor_benefit.sponsorship.pk])
return url + f"#provided-assets-info"


class RequiredAssetMixin(AssetMixin):
Expand Down
35 changes: 0 additions & 35 deletions apps/users/templates/users/sponsorship_assets_view.html

This file was deleted.

2 changes: 0 additions & 2 deletions apps/users/templates/users/sponsorship_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ <h3>Provided Assets</h3>
<br><br>
{% endfor %}
</ul>
<small><a href="{% url 'users:view_provided_sponsorship_assets' sponsorship.pk %}">View all
assets</a></small>
</div>
{% endif %}

Expand Down
6 changes: 1 addition & 5 deletions apps/users/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
views.UpdateSponsorshipAssetsView.as_view(),
name="update_sponsorship_assets",
),
path(
"sponsorships/<int:pk>/provided-assets/",
views.ProvidedSponsorshipAssetsView.as_view(),
name="view_provided_sponsorship_assets",
),

path(
"sponsorships/<int:pk>/",
views.SponsorshipDetailView.as_view(),
Expand Down
21 changes: 0 additions & 21 deletions apps/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,24 +370,3 @@ def form_valid(self, form):
return redirect(self.get_success_url())


@method_decorator(login_required(login_url=settings.LOGIN_URL), name="dispatch")
class ProvidedSponsorshipAssetsView(DetailView):
"""TODO: Deprecate this view now that everything lives in the SponsorshipDetailView."""

object_name = "sponsorship"
template_name = "users/sponsorship_assets_view.html"

def get_queryset(self):
"""Return all sponsorships for superusers, user-visible ones otherwise."""
if self.request.user.is_superuser:
return Sponsorship.objects.select_related("sponsor").all()
return self.request.user.sponsorships.select_related("sponsor")

def get_context_data(self, **kwargs):
"""Add provided assets with values to the context."""
context = super().get_context_data(**kwargs)
provided_assets = BenefitFeature.objects.provided_assets().from_sponsorship(context["sponsorship"])
provided = [asset for asset in provided_assets if bool(asset.value)]
context["provided_assets"] = provided
context["provided_asset_id"] = self.request.GET.get("provided_asset", None)
return context
Loading