fix: Show name of reported content

This commit is contained in:
2025-03-10 22:03:47 +01:00
parent 3607eb0e4e
commit 9086e2e75b
3 changed files with 22 additions and 5 deletions

View File

@@ -429,7 +429,8 @@ def report_detail(request, report_id, form_complete=False):
"""
Detailed view of a report, including moderation actions
"""
report = Report.objects.get(pk=report_id)
# Prefetching reduces the number of queries to the database that are needed (see reported_content)
report = Report.objects.select_related("reportadoptionnotice", "reportcomment").get(pk=report_id)
moderation_actions = ModerationAction.objects.filter(report_id=report_id)
is_mod_or_above = user_is_trust_level_or_above(request.user, TrustLevel.MODERATOR)
@@ -505,7 +506,7 @@ def my_profile(request):
@user_passes_test(user_is_trust_level_or_above)
def modqueue(request):
open_reports = Report.objects.filter(status=Report.WAITING)
open_reports = Report.objects.select_related("reportadoptionnotice", "reportcomment").filter(status=Report.WAITING)
context = {"reports": open_reports}
return render(request, 'fellchensammlung/modqueue.html', context=context)