From 1fa2d40f27504323b6e47d48a69ee2eca0d54f82 Mon Sep 17 00:00:00 2001 From: Jason Harvey Date: Thu, 16 Aug 2012 19:20:43 -0700 Subject: [PATCH] Add a Subreddit property for active_accounts. --- r2/r2/models/subreddit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index bcd690bb5..59c6d0452 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -26,7 +26,7 @@ from pylons import c, g from pylons.i18n import _ from r2.lib.db.thing import Thing, Relation, NotFound -from account import Account +from account import Account, AccountsActiveBySR from printable import Printable from r2.lib.db.userrel import UserRel from r2.lib.db.operators import lower, or_, and_, desc @@ -215,6 +215,10 @@ class Subreddit(Thing, Printable): def flair(self): return self.flair_ids() + @property + def accounts_active(self): + return AccountsActiveBySR.get_count(self) + def spammy(self): return self._spam