From a2a39b6736fc3b8dc518d9941b8a7de3ff749ef3 Mon Sep 17 00:00:00 2001 From: sgfost Date: Wed, 5 Jun 2024 15:58:59 -0700 Subject: [PATCH] fix: only use one submitter for canned forum activity would break when users with certain ids don't exist in a dev environment --- django/home/models.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/django/home/models.py b/django/home/models.py index d2eab447f..eb8421c70 100644 --- a/django/home/models.py +++ b/django/home/models.py @@ -157,14 +157,12 @@ def get_featured_content(self): ).all()[: self.FEATURED_CONTENT_COUNT] def get_canned_forum_activity(self): - random_submitters = User.objects.select_related("member_profile").filter( - pk__in=(3, 5, 7, 11, 13, 17) - ) + submitter = User.objects.select_related("member_profile").last() return [ { "title": f"Generated Forum Topic {i}", - "submitter_name": random_submitters[i].member_profile.name, - "submitter_url": random_submitters[i].member_profile.get_absolute_url(), + "submitter_name": submitter.member_profile.name, + "submitter_url": submitter.member_profile.get_absolute_url(), "date_created": datetime.now(), "url": f"https://forum.example.com/topic/{i}", }