Skip to content

Commit

Permalink
fix: only use one submitter for canned forum activity
Browse files Browse the repository at this point in the history
would break when users with certain ids don't exist in a dev environment
  • Loading branch information
sgfost committed Jun 5, 2024
1 parent 9990ac8 commit a2a39b6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions django/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
}
Expand Down

0 comments on commit a2a39b6

Please sign in to comment.